我有以下类别(多对多关系):
+ post
post_tag
+ tag
post_category
+ category
我如何创建SQL查询来检查哪些标签是在一个帖子没有类别?
谢谢! !
select distinct pt.tagname
from post_tag pt
where not exists
(
select *
from post_category pc
where pc.post_id = pt.post_id
)