Created
April 23, 2015 05:30
-
-
Save doryokujin/eb13424bc06fbacd819a to your computer and use it in GitHub Desktop.
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 number1, number2, COUNT(1) AS cnt | |
FROM | |
( | |
SELECT n1.symbol,n2.symbol, n1.number AS number1, n2.number AS number2 | |
FROM | |
( | |
SELECT number, symbol | |
FROM trump_part | |
WHERE symbol!='joker' | |
) n1 | |
JOIN | |
( | |
SELECT number, symbol | |
FROM trump_part | |
WHERE symbol!='joker' | |
) n2 | |
ON n1.symbol = n2.symbol | |
HAVING n1.number < n2.number | |
) tmp | |
GROUP BY number1, number2 | |
ORDER BY cnt DESC, number1, number2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment