Ok I have 3 tables. Players contains each player, Games contains each game and then Game results contains 2 entries for each game (1 for each player) with their score.

Players
PlayerID  Name
1   Scott
2   Chris
3   Mark
4   Tom

Games
GameID   Name
1   Game 1
2   Game 2
3   Game 3
4   Game 4

Results
ID    PlayerID     GameID    Score
1      1           1         50
2      2           1         40
3      1           2         10
4      3           2         20
5      2           3         30
6      3           3         30
7      1           4         60
8      4           4         20

Now I need to basically bring back a result set that shows
Player: Wins, Losses, Ties

Obviously the Win Loss or Tie would be determined by comparing the score of the 2 players for a given game.  

So the hard part is getting the output.  I am going to have to use structures to hold data while I calculate the wins and losses. Obviously I can easily create 4 structures to start with, one for each player and give them all 0 wins, 0 losses and 0 ties.  Question is how do I then loop through the game results, figure out who won and lost, update the proper structure and then add those structures to yet another structure so I can sort by best record.  Not sure if I explained this well enough, but any help would be appreciated.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to