Use Rewards;
GO

--SELECT *
--FROM SalesData

SELECT *
FROM
(SELECT Customer AS ProductSoldInState, State, Product
	FROM SalesData)
AS DataSet
PIVOT
(
COUNT(Product)
FOR State IN(NSW, VIC, TAS, QLD, NT, SA, WA)
)
AS PvtReturn

