Dec 12, 2009 #1 astralex IS-IT--Management Dec 11, 2009 5 SE Hi, how can I select all prodid in the table below which are availabe in both shopid 1 and 2? The answer should be Prodid 2 Table ProdsInShops Shopid|Prodid ______|_______ 1 |1 1 |2 1 |3 2 |4 2 |2 Thank you!
Hi, how can I select all prodid in the table below which are availabe in both shopid 1 and 2? The answer should be Prodid 2 Table ProdsInShops Shopid|Prodid ______|_______ 1 |1 1 |2 1 |3 2 |4 2 |2 Thank you!
Dec 12, 2009 #2 PHV MIS Nov 8, 2002 53,708 FR SELECT Prodid FROM ProdsInShops GROUP BY Prodid HAVING COUNT(*)>1 Hope This Helps, PH. FAQ219-2884 FAQ181-2886 Upvote 0 Downvote
SELECT Prodid FROM ProdsInShops GROUP BY Prodid HAVING COUNT(*)>1 Hope This Helps, PH. FAQ219-2884 FAQ181-2886
Dec 12, 2009 Thread starter #3 astralex IS-IT--Management Dec 11, 2009 5 SE Great! Thank you for your help! Upvote 0 Downvote
Dec 12, 2009 Thread starter #4 astralex IS-IT--Management Dec 11, 2009 5 SE Sorry, just one more question: how do I add that I want prodid only from shopid 1 and 2? Upvote 0 Downvote
Dec 12, 2009 #5 PHV MIS Nov 8, 2002 53,708 FR SELECT Prodid FROM ProdsInShops WHERE Shopid IN (1,2) GROUP BY Prodid HAVING COUNT(*)>1 Hope This Helps, PH. FAQ219-2884 FAQ181-2886 Upvote 0 Downvote
SELECT Prodid FROM ProdsInShops WHERE Shopid IN (1,2) GROUP BY Prodid HAVING COUNT(*)>1 Hope This Helps, PH. FAQ219-2884 FAQ181-2886