Sum 3 Pivot columns

  • How can I sum 3 pivot columns? I need to sum the columns and have a 4th column with the total. Therefore I would sum MST,BA9,DCT and create a Total column on the same row.

    PIVOT

    (MAX(Terms.AmtPct)FOR ASG_PAY_CODE IN ([MST],[BA9],[DCT])) AS PVTABLE

  • Could you post your complete SELECT statement? Even better, post DDL and sample data. I would recommend to change to cross tabs to facilitate this kind of problems.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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