I have 2 tables, 1 table is order and another table is order_items. Order_items contains many records for a order_id from order. I would like to query table order so that, if the orders contain certain order_items (such as product_item = 'nameProduct'
). it would exclude these orders out of the result. how should I do it?
My current queries are:
select * orders where order_id in (select order_id from order_items where product_item !='nameProduct');
this query not really working because the select order_id from order_items where product_item !='nameProduct'
can still select entry that has same order_id
but just has a different product_item
thanks in advance!