Hi all,
I have built this query and it works fine. However I want the periods to be cumulatve. How can I do this? So period 1 is 1 and period 2 is 1 added 2 etc..
SQL
SELECTTOP(100)PERCENTdbo.grtbk.reknr,dbo.grtbk.oms25_0,SUM(CASEWHENMONTH(ReportingDate)='1'THEN(AmountDCDebit-AmountDCCredit)ELSE0END)AS[1],SUM(CASEWHENMONTH(ReportingDate)='2'THEN(AmountDCDebit-AmountDCCredit)ELSE0END)AS[2],SUM(CASEWHENMONTH(ReportingDate)='3'THEN(AmountDCDebit-AmountDCCredit)ELSE0END)AS[3],SUM(CASEWHENMONTH(ReportingDate)='4'THEN(AmountDCDebit-AmountDCCredit)ELSE0END)AS[4],SUM(CASEWHENMONTH(ReportingDate)='5'THEN(AmountDCDebit-AmountDCCredit)ELSE0END)AS[5],SUM(CASEWHENMONTH(ReportingDate)='6'THEN(AmountDCDebit-AmountDCCredit)ELSE0END)AS[6],SUM(CASEWHENMONTH(...