日期:2014-05-17 浏览次数:20532 次
SELECT SID
,SUM(CASE WHEN IO='应收' THEN Fee ELSE 0 END feeI
,SUM(CASE WHEN IO='应收' THEN 0 ELSE fee END feeO
FROM 表A
GROUP BY SID
--糾正如下:
SELECT SID
,SUM(CASE WHEN IO='应收' THEN Fee ELSE 0 END) feeI
,SUM(CASE WHEN IO='应收' THEN 0 ELSE fee END) feeO
FROM 表A
GROUP BY SID