This is my table.
id customer product
1 Tizag Pen
4 Gerald Garner 19" LCD Screen
5 Tizag 19" LCD Screen
I want to select the customer who has both "Pen" and '19" LCD Screen'. So, the result with be customer 'Tizag'.
How can I do this.
Thanks And Regards, Rupak Banerjee.
Try this:
SELECT customer FROM table t1
JOIN table t2 USING( customer )
WHERE t1.product = 'Pen'
AND t2.product = '19" LCD Screen'
However, the query needs to change if you change the number of products. There might be a better way to do this, but I think this will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With