Created
May 12, 2017 00:21
-
-
Save vincentdesmares/dd8fa788e958da3b559acbd3c7ab12ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM | |
( | |
(SELECT * | |
FROM employe | |
WHERE category = 'A' | |
ORDER BY salary DESC | |
LIMIT 2) | |
UNION (SELECT * | |
FROM employe | |
WHERE category = 'B' | |
ORDER BY salary DESC | |
LIMIT 2) | |
UNION (SELECT * | |
FROM employe | |
WHERE category = 'C' | |
ORDER BY salary DESC | |
LIMIT 2) | |
UNION (SELECT * | |
FROM employe | |
WHERE category = 'D' | |
ORDER BY salary DESC | |
LIMIT 2) | |
UNION (SELECT * | |
FROM employe | |
WHERE category = 'E' | |
ORDER BY salary DESC | |
LIMIT 2) | |
) AS tmp | |
ORDER BY category, salary DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment