Created
June 10, 2019 07:05
-
-
Save Ratstail91/324d08d956d74096e62e5da270bfdcb3 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
#new ladder expression | |
SELECT | |
username, | |
recruits, | |
soldiers, | |
gold, | |
(recruits + soldiers + scientists + spies) AS unitTotal, | |
(SELECT COUNT(*) FROM pastCombat WHERE (attackerId = accounts.id AND victor = 'attacker') OR (defenderId = accounts.id AND victor = 'defender')) AS successfulCombats, | |
( | |
(recruits + soldiers + scientists + spies) + | |
(SELECT COUNT(*) FROM pastCombat WHERE (attackerId = accounts.id AND victor = 'attacker') OR (defenderId = accounts.id AND victor = 'defender')) / 30 + | |
gold / 10 | |
) as rankWeight | |
FROM | |
accounts JOIN profiles ON accounts.id = profiles.accountId | |
ORDER BY | |
rankWeight DESC | |
; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment