July 15, 2010 at 10:49 am
Year Tera Experiant Screen Assessment
2007 400 300 200 100
2008 4000 3000 2000 1000
2009 40000 30000 20000 10000
2010 40000 30000 20000 10000
This sample table I need SQL Query which prints below
2010 2009 2008 2007 Year
10000 10000 1000 100 Assessment
20000 20000 2000 200 Screen
30000 30000 3000 300 Experiant
40000 40000 4000 400 Tera
July 15, 2010 at 4:01 pm
You might want to start with the UNPIVOT statement (see BOL aka BooksOnLine, the SQL Server help sytem for details).
As a next step you should have a look at the CrossTab or DynamicCrossTab article referenced in my signature.
July 19, 2010 at 11:46 pm
I have a blog article to maybe assist you with your question:
http://www.sql-programmers.com/Blog/tabid/153/EntryId/6/Using-PIVOT-and-UNPIVOT.aspx
SQL Server Programmers and Consultants
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply