I have a table as follows:
Product #users Date Count Type prodA 29 2013-02-27 113 Document prodA 31 2013-03-
You can achieve it using CTE.
;WITH CTE AS ( SELECT * FROM Sample PIVOT (SUM([COUNT]) FOR [TYPE] IN (Document, Extraction)) AS PI ) SELECT Product, SUM(Users) AS Users, MAX(Date) AS Date, MAX(Document) AS Document, MAX(Extraction) AS Extraction FROM CTE GROUP BY Product;
SQL Fiddle Demo