PHP_Idiot Posted May 2, 2009 Share Posted May 2, 2009 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 More sharing options...
PHP_Idiot Posted May 2, 2009 Author Share Posted May 2, 2009 Just realised I should probably have put this in the MySQL forum, sorry. But if anyone can help I'd appreciate it. Link to comment https://forums.phpfreaks.com/topic/156509-filter-table-results-by-scores-over-x/#findComment-824136 Share on other sites More sharing options...
fenway Posted May 4, 2009 Share Posted May 4, 2009 Well, you'd need to count by venue first. Link to comment https://forums.phpfreaks.com/topic/156509-filter-table-results-by-scores-over-x/#findComment-826081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.