I am new with Pivot tables but the code below gives me what I want which is a ticket count by year. I am now asked to also report a bottom line total for the two years involved. Is there a way to make that part of this code?
Current Output
2011 data, data, data
2012 data, data, data
Desired Output
2011 data, data, data
2012 data, data, data
Total data, data, data
SELECT *
FROM (SELECT year(ResolvedDate) AS [Year], Week, TicketID
FROM vwWeek) AS s PIVOT (count(TicketID) FOR Week IN ([1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13])) AS p
Normally puts totals up the top (depends on group by), but there are ways to make it look right :)
Will be back in a few - will type up your pivot and have a play first...