Created
October 17, 2014 12:43
-
-
Save stevommmm/07b0a7d9b9e912124117 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 type, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ( | |
(SELECT type, count(type) AS created, 0 AS destroyed FROM `lb-world` INNER JOIN `lb-players` USING (playerid) WHERE playername = 'DOKDOR' AND type > 0 AND type != replaced $dateClause GROUP BY type) | |
UNION | |
(SELECT replaced AS type, 0 AS created, count(replaced) AS destroyed FROM `lb-world` INNER JOIN `lb-players` USING (playerid) WHERE playername = 'DOKDOR' AND replaced > 0 AND type != replaced $dateClause GROUP BY replaced) | |
) AS t GROUP BY type ORDER BY SUM(created) + SUM(destroyed) DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment