Table "Post":
| id | active |
|---|---|
| 382857 | true |
| 382851 | true |
| 383015 | true |
| 382906 | true |
| 382909 | true |
Table "PosTags":
| post_id | tag_id |
|---|---|
| 382857 | 480 |
| 382857 | 953 |
| 382857 | 9230 |
| 382857 | 9232 |
| 382857 | 56677 |
| 382857 | 107901 |
The first table stores posts, while the second one stores postags for each post. I need to gather information regarding posts and tags and I'm using the following query:
SELECT id
FROM posts
WHERE id NOT IN (SELECT post_id FROM post_tags WHERE tag_id = 55723)
LIMIT 8
Problem is that this query won't retrieve posts that have no postags.
Can you help me fixing this query?
EXPLAINand DDL you've used to create mentioned tables?