Q&A for followers of the Hindu religion and those interested in learning more about Hinduism
CREATE TABLE #yt ([Store] int, [Week] int, [xCount] int) ; INSERT INTO #yt ([Store], [Week], [xCount]) VALUES (102, 1, 96), (101, 1, 138), (105, 1, 37), (109, 1, 59) ; select * from #yt; select * from ( select store, week, xCount from #yt ) src pivot ( sum(xcount) for week in ([1], [2], [3]) ) piv;