You are viewing a single comment's thread. Return to all comments →
SELECT MIN(CASE WHEN occupation = 'Doctor' THEN name END) AS Doctor, MIN(CASE WHEN occupation = 'Professor' THEN name END) AS Professor, MIN(CASE WHEN occupation = 'Singer' THEN name END) AS Singer, MIN(CASE WHEN occupation = 'Actor' THEN name END) AS Actor -- You can use MIN or MAX up to you b/c It doesn't effect to the query (they are suppressed by GROUP BY rn) FROM (SELECT name, occupation, ROW_NUMBER() OVER(PARTITION BY occupation ORDER BY name) AS rn FROM occupations) AS t1 GROUP BY rn 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 →