Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
daisyrock
Starting Member
1 Post |
Posted - 2009-11-24 : 05:04:01
|
| I am hoping someone can help me here. This is my first post after registering so hello to all :)I am looking to add some information to a query/report1 is 'YTD' which will SUM all ACTUAL_AMOUNTS for all periods except 00.The other is 'closing balance' which is a grand total/SUM all ACTUAL_AMOUNTSIt has taken me ages to get the query right and now i am not sure where to start entering my last 2 requirements as i built the query using help from this site and am only sql beginner.Here is itSELECT FISCAL_PERIOD, round(SUM(ACTUAL),0) as ACTUAL_AMOUNT FROM(select SUM(T1.TRANSAMNT) AS ACTUAL, T1.PERIOD AS FISCAL_PERIOD from xxx.LEDGER T2, xxx.G_LDETAIL T1where T2.ACCOUNTNO=T1.ACCOUNTNO and T2.PARENT_LEVEL4='xxxxx' and T1.FISCAL_YEAR=2009 group by T1.PERIODUNION ALLselect SUM(T1.TRANSAMNT) AS ACTUAL, T1.PERIOD AS FISCAL_PERIOD from xxx.LEDGER T2, xxx.G_LTRANS T1where T2.ACCOUNTNO=T1.ACCOUNTNO AND T2.PARENT_LEVEL4='xxxxx' AND T1.FISCAL_YEAR=2009 group by T1.PERIOD)TEMPGROUP BY FISCAL_PERIODAny advice would be sincerely appreciated. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-11-27 : 02:31:17
|
| sorry your post is not clear. can you show some sample data to illustrate your scenario please? |
 |
|
|
|
|
|