Archive for October 20th, 2010
Answering questions asked on the site.
In my database, I store the information about the game matches.
A match can be played between two players (mostly) or, occasionally, between two teams of 2, 3 or 4 players.
I store the matches in a table like this:
Game id player1 player2 type
player, the ids of players are stored in the record; if type is
team, those of teams are stored.
Now, the tricky part. For a given game, I need to select two lists of players from both sides, comma separated, be they single players or members of a team.
Are two separate queries required for this?
This of course can be easily done using a single query.
Let’s make a sample table and see:
Read the rest of this entry »