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 |
|
WoodstockCat
Starting Member
1 Post |
Posted - 2005-04-19 : 16:27:32
|
| Hi all. I am working on an ASP.NET application that has data in a table in this format: CategoryID SubCategoryID Month ItemData1 1 Jan 5001 2 Jan 800 1 1 Feb 6001 2 Feb 900I want to have the months at the top of the outputCategoryID SubCategoryID Jan Feb1 1 500 6001 2 800 900There are no "sums" or totals involved..I don't need an agreegate value from ItemData but I do need the column values going across by Date..Any help would be greatly appreciated.. |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-04-19 : 17:07:25
|
| [code]select CategoryID, SubCategoryID, case when month = 'jan' then ItemData else null end, case when month = 'feb' then ItemData else null end, case when month = 'mar' then ItemData else null end, ... and so on until ... case when month = 'dec' then ItemData else null endfrom Mytableorder by CategoryID, SubCategoryID[/code]CODO ERGO SUM |
 |
|
|
|
|
|