I have 2 tables
Person
id
----
1
2
Order
Id Qty
---------
1 3
1 0
2 2
How can I get all persons with orders greater than 0 that have never placed a 0 order? So the result of this would only Person.Id 2
I think I know how to do this with cursors but want to find a different way.
EDIT:
I think in an attempt to make the example short and easy to read I forgot one detailed.. I am not really filtering by Id's. I am filtering by text.
The correct example would be a Customer table, with an order table, in which i want all who have ordered chicken, but have not ordered chicken and fish.
Customer
id
----
1
2
3
Order
Id Dish
----------------
1 chicken
2 chicken
2 fish
3 fish
So the result should only be Customer Id 1