Help need

  • Hi,

    I need a report which is called Spending by Budget source,i get the data from a view and its structure is

    -----------

    Program Year,

    Quarter,

    FundSource Name,

    Amount

    -----------

    I need to prepare a report which wil be in this format

    --------------

    Fund source name Q1 Q2 Q3 Q4

    ------------------------

    Q1,Q2,Q3,Q4 represent Amount in Quarter1,Quarter2,Quarter3,Quarter4 respectively






    Regards,
    Sudheer 

    My Blog

  • I think this query should work out...

    and you should check out this excellent script by Antares on pivot tables http://www.sqlservercentral.com/scripts/contributions/204.asp

    SELECT

    FundSourceName,

    SUM(CASE [Quarter] WHEN '1' THEN Amount ELSE 0 END) as Q1,

    SUM(CASE [Quarter] WHEN '2' THEN Amount ELSE 0 END) as Q2,

    SUM(CASE [Quarter] WHEN '3' THEN Amount ELSE 0 END) as Q3,

    SUM(CASE [Quarter] WHEN '4' THEN Amount ELSE 0 END) as Q4

    FROM Forum GROUP BY FundSourceName

  • hi,

    thnx for advice that worked fine

    cheers,

    sudheer






    Regards,
    Sudheer 

    My Blog

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

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