changing how data is returned and grouping

  • Hello,

    I have a query that currently returns

    CodeNameProject AGradeHrsDay
    5Jones, Mary Project AGrade 54dy
    5Jones, Mary HolidayGrade 50dy
    5Jones, Mary HolidayGrade 50dy2
    5Jones, Mary Project AGrade 54dy2
    5Jones, Mary Project AGrade 54dy3
    5Jones, Mary HolidayGrade 50dy3
    5Jones, Mary HolidayGrade 50dy4
    5Jones, Mary Project AGrade 54dy4
    5Jones, Mary Project AGrade 50dy5
    5Jones, Mary HolidayGrade 50dy5
    5Jones, Mary HolidayGrade 50dy6
    5Jones, Mary Project AGrade 50dy6
    5Jones, Mary Project AGrade 50dy7
    5Jones, Mary HolidayGrade 50dy7

    however I need to modify it to return;

    CodeNameGradeProjectdydy2dy3dy4dy5dy6dy7
    5Jones, Mary Grade 5Project A4444000
    5Jones, Mary Grade 6Holiday0000000

    Someone told me that this is easy to do by just passing the results of the first query into a second query that can format it. However I'm not having any luck finding a resources to help me write this query.

    Does anyone know if it is possible to accomplish just by using another query? and if any resorces to help me

    thanks

  • Am I right, that you don't know in advance how many dy_ columns there will be?

    If so, and given you don't want to do this at the client, have a look here:

    http://www.windowsitpro.com/SQLServer/Article/ArticleID/15608/15608.html

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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