I am having a brain freeze with what originally I thought would be a simple query.
I have a table like the following:
ID DETAILID NAME
-------------------------------------------------
1 1 Sed ut perspiciatis unde
2 1 omnis iste natus error
3 1 sit voluptatem accusantium
4 1 doloremque laudantium
5 2 totam rem aperiam
6 2 labore et dolore
7 3 voluptate velit esse
8 3 occaecati cupiditate non
9 3 culpa qui officia
10 3 placeat facere possimus
11 3 Nam libero tempore
I want to search the NAME field multiple times with LIKE ‘%%’ (number of LIKE’s will be random) but I only want to return a distinct DETAILID where the LIKE’s are all found in records where the DETAILID is the same.
I am going round in circles and getting nowhere fast. Can anybody help?
This query gives you the DETAILIDs that match all the LIKE conditions