Results 1 to 3 of 3

Thread: Combining rows from Query output

  1. #1
    Join Date
    Sep 2011
    Posts
    1

    Question Combining rows from Query output

    I've writen a query which gives following output:

    2412 Person A Product 2
    2412 Person A Product 17
    2413 Person B Product 5
    2413 Person B Product 4
    2413 Person B Product 9
    2416 Person C Product 15
    2417 Percon C Product 2
    2417 Person C Product 13

    I want this to become

    2412 Person A Product 17 Product 2
    2413 Person B Product 9 Product 4 Product 5
    2416 Person C Product 15 Product 2 Product 13

    How to do this??? Please help (I'm a newby at queries!)

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    There's pivot operator in sql2k8.

  3. #3
    Join Date
    Feb 2011
    Location
    Melbourne, Australia
    Posts
    13
    Have a look at this: http://msdn.microsoft.com/en-us/library/ms177410.aspx

    The syntax is a bit messy in my opinion, but you should ba able to do waht you want to with this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •