标签:leftjoin
left join与exists效率比较
sql1: select A.* from tb_a A left join (select AID,MAX(date) from tb_b GROUP BY AID HAVING MAX(date)>NOW()) B ON B.AID=A.id where b.AID IS not NULL sql2: SELECT A.* from tb_a A ……
05-03 立刻查看
sql1: select A.* from tb_a A left join (select AID,MAX(date) from tb_b GROUP BY AID HAVING MAX(date)>NOW()) B ON B.AID=A.id where b.AID IS not NULL sql2: SELECT A.* from tb_a A ……