Jump to content

Filter table results by scores over X


PHP_Idiot

Recommended Posts

Hi I have a table which displays the results of this query:

$query = "SELECT SUM(Position.Points) , Player.FirstName, Player.LastName
FROM Position, Player, Results, Venue
WHERE Player.MembershipNo = Results.MembershipNo
AND Results.Position = Position.Position
AND Venue.VenueID = Results.VenueID
GROUP BY Player.MembershipNo
ORDER BY SUM(Position.Points) DESC"; 
$result=mysql_query($query)
	or die ("couldn't execute query");

As you can see this shows the total points for each player along with their name.

 

I want to update this to only show players with greater or equal to 750 from a specific venue, and display the points, player name and venue where those points where scored.

 

To do this i would need to add all the points scored by each player at each venue and compare them, if a player has a total of 200 points in venue A and 800 points in venue B, I need just the total points for Venue B to show.

However, if a player has 800 total points in Venue A and 900 points at Venue B I need only the highest of these results to show (venue B results).

 

I presume I need to run this in a couple of different queries and save the results in different arrays, is this the right way to go or can it be done in a single query?

 

Thanks alot

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.