2012-12-21 89 views
-4

我有以下幾類(多對多關係):SQL INNER JOIN不存在

+ post 

post_tag 

+ tag 

post_category 

+ category 

如何創建SQL查詢,以檢查其標籤中沒有類別帖子?

謝謝!

+1

你能告訴我們你的表結構嗎? – Mari

回答

3
select distinct pt.tagname 
from post_tag pt 
where not exists 
     (
     select * 
     from post_category pc 
     where pc.post_id = pt.post_id 
     )