Select multiple rows into one row, MS SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hellstenius
    New Member
    • Jun 2006
    • 1

    Select multiple rows into one row, MS SQL

    Hello everybody!

    I need your help with getting the result from a select statement in ms sql, that returns 8 rows, with 4 different values. What I want to have is one row with 9 values.
    This is how the result looks today:

    Region------------Year-------Quantity
    1-Stockholm----2003---------59
    2-Gothenburg---2003---------22
    1-Stockholm----2004---------33
    2-Gothenburg---2004---------44 etc...

    This is how I want it to look:

    Region---------- 2003---------2004--------2005
    1-Stockholm-----59------------33-----------50
    2-Gothenburg----22------------44-----------21

    Any help with this would be much appreciated.

    Sincerely

    Richard Hellstenius
    Last edited by Hellstenius; Jun 29 '06, 02:32 PM.
  • cjjh17
    New Member
    • Aug 2006
    • 1

    #2
    Is this all just in one table?

    Comment

    Working...