E
E
Evgeny Skuridin2014-01-07 12:04:28
MySQL
Evgeny Skuridin, 2014-01-07 12:04:28

SQL query to find posts without tags

Greetings! I ask for help in compiling a SQL query.
Structure:

post (id | title | content)
tag (id | title)
post_tag (id | post_id | tag_id)

We need the id of those posts to which no tag is attached.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
topbanana, 2014-01-07
@skuridin

select id from post where post.id not in (select post_id from post_tag)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question