I am having a sample query data table:
I want my output table to look like:
I tried by using pivot operator but its not possible to sum them all.
I am having a sample query data table:
I want my output table to look like:
I tried by using pivot operator but its not possible to sum them all.
SELECT
*
FROM
(
SELECT * FROM woddb.cityStock_Unpivot
) AS tblCity
UNPIVOT
(
OutputValue FOR [OutputFieldName] IN (Sales, stock, [Target])
) AS UNPVT
PIVOT
(
SUM(OutputValue)
For Category IN (Panel,ac,ref)
) AS PVT