Help me please. How to display a product with a price over 100,

    1 answer 1

    Upd

    select p.* from products p where p.id_product in (select distinct pr.id_product from prices pr where pr.price > 100 ) and p.id_product in (select distinct ms.id_product from magazine_sales ms join sale s on s.id_sale = ms.id_sale where year(s.date_sale) < 2012 ) and (select count(distinct s1.id_customer) from sale s1 join magazine_sales ms1 on ms1.id_sale = s1.id_sale where ms1.id_product = p.id_product ) = 1 

    There is nowhere to check, but it should work.

    • Corrected, corrected the error with the count. - UserTest