I have tables item
and store
(it's a store management system). item
table has a column called store_id
and another column called status
. item.status
can be 'sold' or 'unsold'.
I need help writing a query which will do these things:
- select all items of all stores
- if a store has just one item and that item is 'sold', remove that item from the result set
Thanks in advance!