|
SELECT IFNULL(SUM(skt43.skf610),0)-IFNULL(SUM(skt43.skf669),0),
skt57.skf772
FROM skt57
LEFT JOIN (skt43,skt42)
ON (skt43.skf616=skt42.skf587
AND skt57.skf772=skt42.skf589
AND skt42.skf591=5
AND skt43.skf611>=20110701
AND skt43.skf611<=20110930)
AND skt42.skf597=0
GROUP BY skt57.skf772,skt42.skf590
HAVING skt42.skf590=16;
SELECT IFNULL(SUM(skt43.skf610),0)-IFNULL(SUM(skt43.skf669),0),
skt57.skf772,
FROM skt43,skt42,skt57
WHERE skt43.skf616=skt42.skf587
AND skt57.skf772=skt42.skf589
AND skt42.skf590=16
AND skt42.skf591=5 AND SKT42.SKF597=0
AND skt43.skf611>=20110701
AND skt43.skf611<=20110930
GROUP BY skt57.skf772;
这两个实现的查询结果都是一样的,所以就有疑问了,这两种哪个好,百度了只有讲LEFT JOIN ON和LEFT JOIN WHERE的区别的,越学问题越多呀 |
|