I've got a Sql Table that returns a result as follows:
Amount Descrip
----------------------------
1.34 Group1 Description1
2.36 Group2 Description2
5.46 Group3 Description3
4.54 Group1 Description4
6.23 Group2 Description5
I need to make it look something like this.
Descrip Group1 Group2 Group3
------------------------------------
Description1 1.34
Description2 2.36
Description3 5.46
Description4 4.54
Description5 6.23
The thing to keep in mind is that there is no set rule that Group 3 will exist or any group for that matter. The list of groups is determined by the query results. I could have Group1, Group2, Group4 and Group6 one time and not have group4 but have group5 another.
I know i can do this in .Net code but it would be time consuming in the code. I'd prefer to do it in the SQL server an just bind to the result set.
As a side comment, if there was a way to rollup the values to get a grand total (like 5.88 for Group1) at the bottom, that would be great. I can do the calc at runt time, but would like to do it server side as well if i can.