我有以下类别(多对多关系):
+ post
post_tag
+ tag
post_category
+ category
如何创建SQL查询以检查哪些标签位于没有类别的帖子中?
感谢!!!
答案 0 :(得分:3)
select distinct pt.tagname
from post_tag pt
where not exists
(
select *
from post_category pc
where pc.post_id = pt.post_id
)