SQL语句执行慢,怎么修改?
SELECT 员工, count(完成状态) AS 完成量,sum(完成数) AS 合格数 FROM 表1 WHERE 表1_ID not in
(select 表1_ID from 表1 INNER JOIN 表2 ON 表1.ID = 表2.ID And 表1.机器号 = 表2.机器号 where and 含量<100 and 用量>0 AND 生产时间 between '2011-08-15 00:00:00' and '2011-08-15 23:59:59' group by 表1_ID)
and 完成数>0 AND 生产时间 between '2011-08-15 00:00:00' and '2011-08-15 23:59:59' GROUP BY 员工
现在运行下来很慢,请问各位大哥怎么把 NOT IN 修改成 EXISTS,这样是不是能快一点,要怎么写?
[解决办法]