How to write this SQL ?

  • I can't figure this out, Please help...

    SQL Problem --

    We have a table of orders.

    CREATE TABLE Orders (ordernumber INT, rownumber INT, Description VARCHAR(10))

    The rownumber is guaranteed to always between 1 and 5 and is always filled in consecutively.

    Write SQL that will return the rownumbers as column headers, with the description as the column values. Output similar to below:

    Order#Row1 Row2 Row3 Row4Row5

    10 Desc1Desc2

    20 Desc1Desc2desc3

    Please help... Thanks!

  • This is called PIVOT or CROSS TAB[/url] query.

    --Vadim R.

  • OK, I see, use pivot tab, thanks for the link and your help.

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

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