Created
February 28, 2018 07:40
-
-
Save Goryudyuma/1d0b975d4a2daf628e2923c05c63de8e to your computer and use it in GitHub Desktop.
MISQUERY ONLINE
This file contains 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 n | |
FROM ( | |
(WITH RECURSIVE numbers (x) AS ( | |
SELECT 2 | |
UNION ALL | |
SELECT x + 1 FROM numbers WHERE x <= 10000) | |
SELECT tbl.n, COUNT(tbl.n) | |
FROM numbers AS n | |
INNER JOIN tbl | |
ON MOD(tbl.n, x) = 0 | |
GROUP BY tbl.n) | |
) AS ans | |
WHERE ans.count = 1 | |
ORDER BY ans.n; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment