Jump to content

Specific Query with Two Tables


skyace888

Recommended Posts

I am working on a PHP/MySQL statistics tracking program for a basketball team.  It is something I'm doing for a class.  I have two tables, Play_Log and Play_Outcome_Log, for which I need to run a query on.  Here is what I have so far:

SELECT OutcomeID, Code1 FROM Play_Outcome_Log, Play_Log WHERE Play_Outcome_Log.OutcomeID=5 AND Play_Outcome_Log.PlayID = Play_Log.PlayID AND Play_Log.PlayCode='O'

I am trying to run a query that tells me the player number with the most 2-point baskets on the team (in this example).  The OutcomeID represents the code of the play.  "5" is for a 2-point basket.  Since I want it for the main team, I choose 'O' for PlayCode meaning offensive.  Here is what was returned:

OutcomeID  Code1
5              3
5              3
5              32

I have not added all of the plays in, but at this point, player #3 is the one with the most 2-point baskets.  How can I change the query so I only receive this one number as my result (the player number with the most 2-point baskets)?  Hopefully I have explained this clearly.

Thanks,
Al
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.