You are viewing a single comment's thread. Return to all comments →
MS SQL Server
WITH CTE_Enumerada AS ( SELECT Name, Occupation, ROW_NUMBER() OVER (PARTITION BY Occupation ORDER BY Name) AS rn FROM OCCUPATIONS ), PivotFinal AS ( SELECT * FROM CTE_Enumerada PIVOT ( MAX(Name) FOR Occupation IN ([Doctor], [Professor], [Singer], [Actor]) ) AS p ) SELECT Doctor, Professor, Singer, Actor FROM PivotFinal ORDER BY rn;
Seems like cookies are disabled on this browser, please enable them to open this website
Occupations
You are viewing a single comment's thread. Return to all comments →
MS SQL Server