Re: how do i select this list
| From: | João Cândido de Souza Neto | Date: | Wed, 15 Mar 2006 17:06:31 +0000 |
| Subject: | Re: how do i select this list | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231955@lists.php.net to get a copy of this message | ||
$query = mysql_query("SELECT * FROM leaderboard WHERE comp_id = $comp_id
ORDER by points DESC, margin ASC ");
Mark wrote:
> The query below gives me a list of usernames with the highest point score
> at the top. There is also a secondary points list which i need to use to
> rank players if there POINTS are the same.
>
> ie:
> username points margin
> paul 26 24
> mark 23 11
> john 23 10
>
> I want to rank 'john above 'mark' as his margin points are lower. I can't
> rank by margin alone and i need ranking by points (Desc) first then by
> lowest margin.
> how can i change this statement below to achieve this.
>
> Thanks
>
> $query = mysql_query("SELECT * FROM leaderboard WHERE comp_id = $comp_id
> ORDER by points DESC ");
--
---------------------------------------------------
João Cândido de Souza Neto
Web Developer