|
谢谢版主的回复,可能是我说的不清楚,不是你上面写得哪样:如果不根据时间段下面就可以实现.
==================================================
SELECT c.客户名称, Sum(b.货款) AS 货款总计, Sum(a.回款) AS 回款总计
FROM (c INNER JOIN a ON c.客户ID = a.客户ID) INNER JOIN b ON c.客户ID = b.客户ID
GROUP BY c.客户名称;
====================================================
如果sum(b.货款) AS 货款总计 ,Sum(a.回款) AS 回款总计 有时间段限制如何写,比如货款时间是2008/1/1到2008/12/31 ,回款是2008/6/1到2009/1/31.
=========================================
解决方法有好多,我想要的问题在一个SQL查询里能不能实现各个表有时间段的限制语句.,只是好奇一下我这种想法可不可行. |
|