Weird grouping requirement

  • I have a Table1 with the following data:

    District Area WeatherID

    D1 1A 1

    D1 1B 1

    D1 1C 2

    D2 2A 1

    D2 2A 3

    D2 2B 2

    D3 3A 1

    D3 3B 2

    D3 3C

    Now I want to group on District and Area in such a way that the result set looks like:

    District Area WeatherID

    1A 1

    1B 1

    1C 2

    D1 1,2

    2A 1,3

    2B 2

    D2 1,2,3

    3A 1

    3B 2

    3C

    D3 1,2

    Any suggestions?

    Thanks!

  • Could you re-post the question in a manner which makes the desired result a little more clear. It looks like some of the results rows have commas and some don't the rows with commas seem to have more columns. You may want to insert the results in a table to make it a little more clear. Also a code block may help.

    Thanks,

    Steve
    http://stevefibich.net
    http://utilitydb.codeplex.com/

  • The result table should look like the attached pic.

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

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