Sql Query

  • 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

  • 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.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • 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

    http://www.sql-programmers.com/

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply