'Exclude returned orders & Home Office orders from the orders dataset

enter image description here enter image description hereI am trying to Exclude returned orders & Home Office orders from the orders dataset

I have 2 datasets order and returns in order dataset it's order summary in returns dataset there is column return yes or no order_id , region

select * from orders where order_id not in 
(select a.order_id, b.returned 
from orders a
join returns b
on a.order_id = b.order_id
where a.category = 'home_office') ;

while doing this i am getting this error Error Code: 1241. Operand should contain 1 column(s) i just want to figure out how to exclude return= yes orders using join

i want order table as it is however if based on table 2 return if order has been returned it should be excluded from table 1 when i see results



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source