I'm looking for a fast way to search in a table by excluding results in a join.
Two simpelfied tabels:
table 1
- article_id
- term_id
table 2
- article_id
- loc_id
In table 1 there can be multiple rows for the same article_id, it can be linked to multiple terms. I'm looking for a select query to get all the results from table 2, with loc_id 1 that dont have a row in table 1 with term_id 20.
The two tables are joind on there article_ids ofc.
If i use a normale join, and then set a where on term_id != 20, i still get the results if the article is linked to term_id 19.
Try this: