I have a dataset that looks like the following:
CDATE | TRANSACTIONS | TOTALBALANCE | TRANSDATE
2003-01-15 | 30 | 5000 | 4-2007
2003-01-15 | 30 | 5000 | 4-2007
2003-02-15 | 40 | 4000 | 4-2007
2003-03-15 | 20 | 5500 | 4-2007
2003-03-15 | 15 | 5500 | 5-2007
2003-03-15 | 15 | 5500 | 6-2007
And so on
I'd like to query this so I get something like this:
CDATE | BALANCE | 04-2007 | 05-2007 | 06-2007 | TRANS TOT
2003-01-15 | 5000 | 60 | 0 | 0 | 60
2003-02-15 | 4000 | 40 | 0 | 0 | 40
2003-03-15 | 5500 | 20 | 15 | 15 | 50
Essentially I wish to group the 'CDATE' together with their totals (the total column is always the same across CDates because of the way it was set up) followed by the transactions grouped by date and a total.