Skip to content

Instantly share code, notes, and snippets.

@ctfaddict
Created April 24, 2014 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctfaddict/f7964a281ef7f57c301c to your computer and use it in GitHub Desktop.
Save ctfaddict/f7964a281ef7f57c301c to your computer and use it in GitHub Desktop.
scorebot_production=# select t1.name as team, sum(count) as total, avg(count) as per_token
from (select t.name, r.id, count(*) as count
from captures c, redemptions r, teams t, tokens k, instances i
where c.redemption_id = r.id and r.token_id = k.id and k.instance_id = i.id
and i.team_id != r.team_id and r.team_id = t.id
group by t.name, r.id) as t1
group by t1.name
order by avg(count) desc;
team | total | per_token
---------------------------+-------+--------------------
PPP | 12845 | 7.8037667071688943
raon_ASRT | 6241 | 5.4364111498257840
men in black hats | 5115 | 4.7229916897506925
APT8 | 67 | 4.1875000000000000
more smoked leet chicken | 3656 | 3.1194539249146758
sutegoma2 | 1041 | 2.0096525096525097
Samurai | 674 | 1.8516483516483516
9447 | 1005 | 1.8043087971274686
routards | 776 | 1.7921478060046189
shellphish | 1477 | 1.7035755478662053
pwnies | 832 | 1.6842105263157895
Alternatives | 1181 | 1.5831099195710456
blue lotus | 1104 | 1.5144032921810700
The European Nopsled Team | 777 | 1.3949730700179533
shell corp | 606 | 1.2811839323467230
pwningyeti | 702 | 1.2294220665499124
WOWHacker-BI0S | 423 | 1.2120343839541547
[Technopandas] | 370 | 1.1111111111111111
clgt | 274 | 1.0378787878787879
Robot Mafia | 99 | 1.0206185567010309
(20 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment