select * from s_qf q where q.yf not in (select l.yf from s_lf_history l where l.yhid = q.yhid )
与
select * from s_qf q where q.yhid not in (select l.yhid from s_lf_history l where l.yf = q.yf )
的区别
公司强人写的
select t.* from s_qf t where not exists (select t2.yhid from s_lf_history t2 where t2.yhid=t.yhid and t2.yf=t.yf)
本文探讨了三种不同的SQL查询方法:使用NOT IN与NOT EXISTS子句排除特定条件的记录。通过对比SELECT * FROM s_qfq WHERE q.yf NOT IN (...)与SELECT * FROM s_qfq WHERE q.yhid NOT IN (...)及not exists子句的用法,揭示了它们在效率与易读性方面的差异。
7480

被折叠的 条评论
为什么被折叠?



