Making into one row instead of multiple

  • I have a table that looks similar to this:

    Col1 Col2 Col3

    1 1234 9876

    1 1234 7654

    2 1111 1357

    3 2222 1010

    3 2222 2020

    And my desired result I want to look like this:

    Col1 Col2 Col3.a Col3.b

    1 1234 9876 7654

    2 1111 1357

    3 2222 1010 2020

    Was wondering if someone had an idea of how to accomplish this?

    Thanks

  • you can accomplish this using a pivot table or cross tab. Jeff Moden has a great 2 part series of articles on this

    http://www.sqlservercentral.com/articles/T-SQL/63681/ Part1

    http://www.sqlservercentral.com/articles/Crosstab/65048/ Part 2


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

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

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