Skip to content

Instantly share code, notes, and snippets.

@Noxville
Created February 2, 2015 11:31
Show Gist options
  • Save Noxville/40b53443a0c3603fa12b to your computer and use it in GitHub Desktop.
Save Noxville/40b53443a0c3603fa12b to your computer and use it in GitHub Desktop.
SQL Winner Group By Faction, limited by teams Rating.
SELECT m.winner as winner, count(*) as cnt
from mtch m
JOIN elo_team_data_point radiant_elo
ON (m.radiant_team = radiant_elo.team and DATE(m.date) = radiant_elo.elo_date)
JOIN elo_team_data_point dire_elo
ON (m.dire_team = dire_elo.team and DATE(m.date) = dire_elo.elo_date)
WHERE
(radiant_elo.rating > 1200) and
(dire_elo.rating > 1200) and
(m.match_id >= 1098011255) and
abs(radiant_elo.rating - dire_elo.rating) <= 100
GROUP by winner;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment