Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.
Declare @strSQL varchar(max) DECLARE @cols varchar(2000) -- Assigning Y here just for demo purposes, populate however you want. Declare @UTILIZED char(1) = 'Y' SELECT @cols = STUFF(( SELECT DISTINCT '],[' + cast(Level3 as varchar) From PPS_SKU_UTILIZATION ORDER BY 1 FOR XML PATH('') ), 1, 2, '') + ']' set @strSQL = 'select YEAR, MONTH, ' + @cols + ' from ( select YEAR, MONTH, Level3, UTILIZED from PPS_SKU_UTILIZATION WHERE UTILIZED=''' + @UTILIZED + ''') o pivot (COUNT(UTILIZED) for Level3 in (' + @cols + '))p ORDER BY MONTH' exec(@strSQL)
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.