Reputation: 3381
How do I add a total column to this query?
SELECT YearOfAccount, [Completed] AS Closed, [Open] AS Opened
FROM
(SELECT YearOfAccount, Status, CaseCode
FROM Records ) myRecords
PIVOT
(
COUNT(CaseCode)
FOR [Status] IN
( [Completed], [Open])
) AS pvt
Currently I am getting back the results I want but I want to include a total column on the far right for all records that are completed or Open.
Upvotes: 0
Views: 1691