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
https://forums.phpfreaks.com/topic/156509-filter-table-results-by-scores-over-x/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.