[Solved] SQL query to retrive data [closed]


Better version in a single query:

select p1.productname from Product p1, myorder s1, lineitem l1, customer c1
where l1.pid=p1.pid
and l1.OID=s1.oid
and c1.cid=s1.cid
and c1.city='mycity'
group by p1.ProductName
having count(distinct c1.cid)=(select count(1) from customer c2 where c2.city='mycity');

solved SQL query to retrive data [closed]