Quote:
Originally Posted by Whatever
I am not an SQL expert so I was hoping someone could help me out.
Some trivia questions I was curious in:
3. Alliance with the narrowest range of team numbers;
4. Alliance with the widest range of team numbers;
|
Widest range:
sqlite> select a.team, b.team, c.team, max(a.team - c.team) from match_teams a join match_teams b on a.match=b.match and a.team > b.team join match_teams c on b.match = c.match and b.team > c.team where a.alliance_color = b.alliance_color and b.alliance_color = c.alliance_color ;
6231|5536|11|6220
Narrowest:
sqlite> select a.team, b.team, c.team, min(a.team - c.team) from match_teams a join match_teams b on a.match=b.match and a.team > b.team join match_teams c on b.match = c.match and b.team > c.team where a.alliance_color = b.alliance_color and b.alliance_color = c.alliance_color ;
177|176|175|2