Skip to content

Instantly share code, notes, and snippets.

@dpassage
Created May 10, 2012 03:03
Show Gist options
  • Select an option

  • Save dpassage/2650760 to your computer and use it in GitHub Desktop.

Select an option

Save dpassage/2650760 to your computer and use it in GitHub Desktop.
Sample Bayou Grand Prix SQL
select d.name, t.color, SUM(sg.points), t.name
from raceresults rr, races r, scoring sg, drivers d,
teams t, seasondrivers sd, schedule k where
k.season = $season and
k.race = r.id and
rr.race = r.id and
rr.driver = d.id and
rr.place = sg.place and
rr.dnf = FALSE and
sd.driver = d.id and
sd.defaultteam = t.id and
sd.season = k.season and
sg.scheme = $schemeid
group by d.name, t.color, t.name
order by 3 desc, 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment