You are viewing a single comment's thread. Return to all comments →
SELECT MIN(IF(occupation = "Doctor", name, NULL)) AS "Doctor", MIN(IF(occupation = "Professor", name, NULL)) AS "Professor", MIN(IF(occupation = "Singer", name, NULL)) AS "Singer", MIN(IF(occupation = "Actor", name, NULL)) AS "Actor" FROM ( SELECT name, occupation, ROW_NUMBER() OVER(PARTITION BY occupation ORDER BY name) AS indexing FROM occupations ) AS short_table GROUP BY indexing;
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 →
For MySQL