Can someone help with a case statement that will turn the sample table below to appear as follows:
At the moment the table looks as follows:
Sample data is as follows:
CREATE TABLE #tmpTable (
Channel nvarchar(50),
Months nvarchar(50),
Total Sales int)
INSERT #tmpTable VALUES
(N'Online',N'Jan',1427),
(N'Online',N'Feb',1486),
(N'Online',N'Mar',1325),
(N'Online',N'Apr',1065),
(N'Online',N'May',803),
(N'Online',N'Jun',661),
(N'Online',N'Jul',665),
(N'Online',N'Aug',912),
(N'Online',N'Sep',1444),
(N'Online',N'Oct',1689),
(N'Online',N'Nov',1763),
(N'Online',N'Dec',1440),
(N'Social Media',N'Jan',1025),
(N'Social Media',N'Feb',925),
(N'Social Media',N'Mar',769),
(N'Social Media',N'Apr',555),
(N'Social Media',N'May',412),
(N'Social Media',N'Jun',325),
(N'Social Media',N'Jul',341),
(N'Social Media',N'Aug',495),
(N'Social Media',N'Sep',949),
(N'Social Media',N'Oct',1126),
(N'Social Media',N'Nov',1273),
(N'Social Media',N'Dec',1067),
(N'Outlet',N'Jan',125),
(N'Outlet',N'Feb',96),
(N'Outlet',N'Mar',73),
(N'Outlet',N'Apr',88),
(N'Outlet',N'May',65),
(N'Outlet',N'Jun',53),
(N'Outlet',N'Jul',45),
(N'Outlet',N'Aug',66),
(N'Outlet',N'Sep',145),
(N'Outlet',N'Oct',199),
(N'Outlet',N'Nov',202),
(N'Outlet',N'Dec',181),
(N'Stores',N'Jan',639),
(N'Stores',N'Feb',641),
(N'Stores',N'Mar',418),
(N'Stores',N'Apr',398),
(N'Stores',N'May',329),
(N'Stores',N'Jun',306),
(N'Stores',N'Jul',258),
(N'Stores',N'Aug',398),
(N'Stores',N'Sep',701),
(N'Stores',N'Oct',879),
(N'Stores',N'Nov',961),
(N'Stores',N'Dec',818)
SELECT * FROM #tmpTable