Multi row to one row separate column also

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karuszzzz
    New Member
    • Oct 2013
    • 1

    #1

    Multi row to one row separate column also

    Now i have a MSSQL table, Material

    The fields are as below,

    Type, Mat_Name, Size1, Size2, Size3
    A, Wood, 100, 100, 100
    A, Iron, 200, 200, 200
    A, Steel, 300, 300, 300
    B, Plastic, 400, 400 ,400
    B, Ore, 500, 500, 500
    B, Glass, 600, 600, 600

    Can i display them as below?

    A, Wood, 100, 100, 100, Iron, 200, 200, 200, Steel, 300, 300, 300
    B, Plastics, 400, 400, 400, Ore, 500, 500, 500, Glass, 600, 600, 600

    Seeking help from publics, thanks
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Your thread has been moved to the SQL Server forum.

    Not easily. Depending on what version of SQL Server you have, you can use XML path or you will need to use a cursor.

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      Here are some options...

      Good Luck!!!


      ~~ CK

      Comment

      Working...