Need help with pivot table in SQL server

  • I am trying to get my data into one row. I am trying to pivot this but no luck Here is the start data:

    ID Total Due

    3065765 145.78

    3065765 22.58

    3065765 57.92

    I need to have:

    ID Total Due Total Due2 Total Due3

    3065765 145.78 22.58 57.92

  • See these two articles by Jeff Moden:

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

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

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