Hi I need help on a sql query. The result must match values for a single column across the rows. Here is an example. I need to find out store(s) that must have all of these items for sale: Books, Stationery, and Toys.
Store Items
----- --------
AA PERFUMES
AA TOYS
BB STATIONERY
BB BOOKS
BB TOYS
In the example above, "BB" is the only store that matches all of our criteria and hence the result expected from the query.
I tried query with AND operator (select store from storeitem where items = 'books' and items ='toys' and items='stationery';) and it did not work as it expects all values in the same row and with in operator (select store from storeitem where items in ('books','stationery','toys');) , this doesn't follow must match all values criteria.
Need your help on this.