So I have a table that has a FK to a UserId, and a FK to a ProductId.
Each UserId can be listed multiple times if they have multiple products.
I need to query to get each UserId that has, for example, ProductId 1, but NOT ProductId 2.
How can I get started writing a query like this?
Edit:
But here is the part I’m having problems with; all users who have Product 1 should have Product 2, but some don’t, so I need to get the users who have Product 1 and NOT Product 2
1 Answer