SELECT a1.planet, a1.score, COUNT( a2.score ) as rank FROM pa_planet_listing a1, pa_planet_listing a2 WHERE a1.score <= a2.score OR ( a1.score = a2.score AND a1.planet = a2.planet ) GROUP BY a1.planet, a1.score ORDER BY a1.score DESC , a1.planet DESC ;
Ranking SQL results?
Posted 02 August 2006 - 07:39 PM
Posted 02 August 2006 - 07:46 PM
Posted 02 August 2006 - 07:48 PM
Posted 02 August 2006 - 07:50 PM
or [php] * 1000... PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...
Posted 02 August 2006 - 07:57 PM
you use $result for planet, $result for score and $result for rank.
Or you might try to name these fields with the AS in MySql, and you could address them as
$result['planet'], $result['score'] and $result['rank'].
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users