Wednesday, December 20, 2006

DG Tournament updated

I updated DG Tournament with the results of the drawing for the second round of the UEFA Champions League.

You can now start betting on the games of the 1/8 Finals! (see screenshot)

Some technical background about this update.
(you can't see the adaptation as it's in the "editor/admin" section of the application)
To add the matches of the next round I created a tabular form with dropdown lists of the teams.
I used an analytical functions to get the first two teams of each group:

SELECT t.team_name, t.team_id
FROM tdg_team t,
(SELECT r.team_id, rank() over (PARTITION BY r.team_group_id ORDER BY r.points DESC, r.matches_won DESC, r.goals_difference DESC, r.goals_scored DESC) team_rank
FROM tdg_match_rank r
WHERE r.tournament_id = :TDG_AI_TOURNAMENT_ID) rt
WHERE t.team_id = rt.team_id AND rt.team_rank IN (1,2)

I use analytical functions more and more. I find them really powerful!

1 comment:

Alex Nuijten said...

Absolutely, using analytics is an acquired taste. Once you start using them, you'll want to use them more and more. Almost an addiction. ;-)