Group kết quả trong select query !
hieu115 > 02-01-14, 06:48 PM
Câu lệnh :
SELECT DISTINCTROW
TRN.[Department Analysis Code],
IIf([Accounting Period]='2014/001',Sum([Base Amount]),"") AS T1,
IIf([Accounting Period]='2014/002',Sum([Base Amount]),"") AS T2,
IIf([Accounting Period]='2014/003',Sum([Base Amount]),"") AS T3,
IIf([Accounting Period]='2014/004',Sum([Base Amount]),"") AS T4,
FROM TRN
GROUP BY TRN.[Department Analysis Code], TRN.[Accounting Period]
HAVING (((TRN.[Department Analysis Code])<>" "));
Tuy nhiên kết quả xuất ra như sau:
Department Analysis Code T1 T2 T3 T4
10-00 111
10-00 5253
10-00 944
10-00 309
Em cần kết quả như sau :
Department Analysis Code T1 T2 T3 T4
10-00 111 5253 944 309
Ý là group trên cùng 1 dòng theo Department Analysis Code
Cảm ơn mọi người !