0.3546 秒
select * from tb_a,tb_b where tb_b.chargeOK='0' and tb_b.state='1' and tb_a.projectNum=tb_b.projectNum and tb_a.department='1' and tb_a.projectManager='张三' order by tb_b.reportnum desc
0.3506 秒
select * from tb_a inner join tb_b on tb_b.chargeOK='0' and tb_b.state='1' and tb_a.department='1' and tb_a.projectManager='张三' and tb_a.projectNum=tb_b.projectNum order by tb_b.reportnum desc
0.1358 秒
select * from (select * from tb_a where tb_a.department='1' and tb_a.projectManager='张三') tb_a inner join (select * from tb_b where tb_b.chargeOK='0' and tb_b.state='1') tb_b on tb_a.projectNum=tb_b.projectNum order by tb_b.reportnum desc
结论:用(select * from tb where 条件 )缩小范围后,作为from和join的表可提高查询速度