select sum(a.perdblnc), a.actindx
from [CASH].[dbo].[GL00100] b
inner join [CASH].[dbo].[GL10111] a
on b.actindx = a.actindx
where b.actnumbr_1 = 1020
group by a.actindx
Return:
42378.15000 41
54072.64000 42
31698.21000 43
75552.65000 44
select sum(a.perdblnc), a.actindx
from [CASH].[dbo].[GL00100] b
inner join [CASH].[dbo].[GL10110] a
on b.actindx = a.actindx
where b.actnumbr_1 = 1020
group by a.actindx
Retuns:
28711.94000 41
53781.08000 42
26281.17000 43
69345.59000 44
我需要合併它,以便它返回總和或兩個查詢。最終的結果應該是:梳理查詢
57423.88 41
107562.16 42
52562.34 43
138691.18 44
呃,那麼你如何使用工會來解決這個特殊問題呢? – Andomar 2011-01-21 16:09:36