Leander
Leander

Reputation: 1395

SQlite "Is not existing in"

I have the following problem. I want to have an Select statement, where I compare 2 ID's and get the ID's who are in Table 1 and NOT in Table 2. This is my last Try.

SELECT * FROM Categories, Stores WHERE Categories.idCategories NOT IN ( Stores.category ) GROUP BY Categories.idCategories

is it even possible. According to this I should have tried all operators, but I am really no expert in SQL, especially in SQlite, so I might have forgotten something.

Upvotes: 0

Views: 52

Answers (1)

rjf
rjf

Reputation: 1007

Try this:

SELECT * 
FROM Categories 
WHERE Categories.idCategories NOT IN ( select category from Stores ) 
GROUP BY Categories.idCategories

Upvotes: 1

Related Questions