Jump to content

MAX () Problem in query


Wykster

Recommended Posts

Hi,

 

Please bear with me as I am learning this stuff.  I have a query that gives

me the top 5 players of a dart team by their maximum average.  When I run

it, I get the top 5 averages but they are all distinct players names.  I

know for a fact that in the top 5 averages the same player is in positions

1, 2, and 3.  Here is the query that I have built, I aplogise but could

somebody advise me on how to change the query to give me the top 5

regardless of the same player appearing in the top 5.

 

$max_average_mb_sql = mysql_query("SELECT MAX(match_records.ave) AS mbave,

players.playerID,

players.playerName, players.surname

FROM match_records, players

WHERE match_records.playerID = players.playerID

AND match_records.seasonID = $season_seasonid

AND match_records.MorF = 'M'

AND match_records.AorB = 'B'

AND match_records.W_L = 'W'

GROUP BY players.playerName, players.surname

ORDER BY mbave DESC

LIMIT 0 , 5");

 

Regards

Dave

 

Link to comment
https://forums.phpfreaks.com/topic/79620-max-problem-in-query/
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.