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 |
|
ricc
Starting Member
16 Posts |
Posted - 2005-10-25 : 09:48:14
|
| Little complex but I'll try to explain best I canI have the following table…UserID___Year___Month___A1____A2____B1___B2__1_______4______5______45_____5____43____0__1_______4______6______10_____12___1_____3__1_______5______5______12_____22___8_____7__1_______5______6______11_____10___5_____0__2_______4______5______9______65___33____66__2_______4______6______3______3____10____11__2_______5______5______44_____2___77_____1I want to pull out the data to show the sum of the totals for each year the user is in. The idea is to then be able to see a comparison for year on year on a month by month basisEg.UserID____TotalAYear4____TotalBYear4___TotalAYear5____TotalBYear5___Month__1___________50_____________43___________34____________15__________5__1___________22_____________4____________21____________5___________6__2___________74_____________99___________21____________5___________5There would be no data returned for UserID2 for month 6 as there is no data for them for year 5 month 6 therefore no comparison can be made.I’ve having real difficulty getting the correct SQL syntax to do this. Any ideas or pointers would be great thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|