主题表 id ,title,content回复表 id content,zid(关联主题id)select a.* from 主题表 a where not exist (select b.* from 回复表 b where a.id=b.id)
主题表 id ,title,content回复表 id content,zid(关联主题id)1.select a.* from 主题表 a where a.id not in(select distinct b.zid from 回复表 b)2.select a.* from 主题表 a left join 回复表 b on a.id=b.zid where b.zid is null
SELECT * FROM Ö÷Ìâ±í WHERE Ö÷Ìâ±íID NOT IN (SELECT »Ø¸´±íÖеÄÖ÷Ìâ±íID FROM »Ø¸´±í)
SELECT * FROM 主题表 WHERE 主题表ID NOT IN (SELECT 回复表中的主题表ID FROM 回复表)
select a.* from 主题表 a where not exists (select b.* from 回复表 b where a.id=b.zid)
id ,title,content回复表
id content,zid(关联主题id)
id ,title,content回复表
id content,zid(关联主题id)select a.* from 主题表 a where not exist (select b.* from 回复表 b where a.id=b.id)
id ,title,content回复表
id content,zid(关联主题id)1.select a.* from 主题表 a where a.id not in(select distinct b.zid from 回复表 b)2.select a.* from 主题表 a
left join 回复表 b
on a.id=b.zid
where b.zid is null