找出所有只设置了子tag但没有设置parent tag的orpha tag状态的主题帖的sql:
SET @parentTagID = 15;
SELECT DISTINCT discussion_id FROM prefix_discussion_tag AS A WHERE discussion_id IN (SELECT discussion_id FROM `prefix_discussion_tag` WHERE tag_id IN (SELECT id FROM prefix_tags WHERE parent_id = @parentTagID)) AND NOT EXISTS (SELECT 1 FROM prefix_discussion_tag WHERE discussion_id = A.discussion_id AND tag_id = @parentTagID) ORDER BY discussion_id ASC;