Saturday, June 28, 2014

Display total qty sold of each item of each store

using PIVOT



SELECT [Item#],
[Store A] + [Store B] + [Store C] AS SaleTotal,
[Store A],[Store B],[Store C]
FROM ItemMovement i
PIVOT (SUM(QtySold) FOR [Store#] IN ([Store A],[Store B],[Store C])) p



Replace Store A,Store B etc with actual values in Store# column




Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment