日期:2014-05-16 浏览次数:20493 次
SELECT a1.aid,a1.username,ISNULL(b.[money],0.00)[moneytotal]
FROM a1 LEFT JOIN (SELECT aid,SUM([money])[money] FROM b2 GROUP BY aid) b2 ON a1.aid=b2.aid
select aid,
username,
(select SUM(money) from B2 where a1.aid = b2.aid) moneytotal
from a1
select aid,
username,
isnull((select SUM(money) from B2 where a1.aid = b2.aid),0) moneytotal
from a1