This not really the right place to ask this but I'm not sure where to move it, unless you are using Access and I can it there.
It would help to show your entire SQL statement. I don't know what you are trying to SELECT.
You have at least two problems in what you've shown.
- Your values in the "in" clause need to be in quotes. I am surprised this is not giving you an error.
- The condition you are trying to write will evaluate each record. No one record can have more than one product ID, so if you specify that the record must match more than one, it can't, and you get 0 records back.
SELECT CustomerName
FROM your_table_name
WHERE PRODID IN ('20200B' , '20700A', '304Z')
GROUP BY CUSTID
HAVING COUNT(DISTINCT PRODID) = 3;
This will list the customers that have all three of the desired products.
I do not have a database set up to test this.
Bookmarks