Dear Listers,

This is presenting a challenge to my SQL skills of how to attack this,
hopefully someone else might be able to help point me in the right
direction.

I'm building an application to track sports contests. Essentially players,
each of whom are members of a specific "club", guess every week on who will
win a game and what the score is.

So I have a table of games:

Id,
Visitor_id,
Home_id,
Visitor_score,
Home_Score

And teams:

Id,
Visitor_id,
Home_id,
Visitor_score,
Home_Score

And players:

Id,
Player_name,
Club_id

And clubs:

Id,
Club_Name

And every week, I populate my "picks" table with picks from players:

Id,
Player_id,
Game_id,
Visitor_score_guess,
Home_score_guess

So what I'm trying to do is to get a list of player rankings by
correct/incorrect guesses (or "wins and losses").

On a given week, several players will enter one or more records (rows) in
the "picks" db, each referring to a game, and guesses the game score.

So what I want to do is compare the pick scores (stored in the picks DB) to
the actual score (stored in the games db), determine if the player guessed
correctly, and flag that as a "win" (ie a correct guess) or a "loss"
(incorrect guess). Then sum that result over time to determine player
rankings, ie the player with the most "wins" is at the top of the list.

Any input, general direction or (best case) sample code would be greatly,
greatly appreciated.

Best,

Peter D Bethke


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to