Re: mysql question.

From: Date: Tue, 03 Apr 2007 13:20:11 +0000
Subject: Re: mysql question.
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43403@lists.php.net to get a copy of this message
On 4/3/07, Me2resh Lists <me2resh.lists@gmail.com> wrote:
hi i need help regarding a sql query in my php app. the query is :
    $SQL = "SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list"; i want to sort this query by the number of the repeated EMail counts. can anyone help me with that please ?
$SQL = "SELECT EMail,count(EMail) AS repeated FROM mena_guests WHERE Voted = 'yes' GROUP BY EMail ORDER BY count(EMail) LIMIT $startingID,$items_numbers_list"; I can't remember if in the order clause you can order by the alias of the field or using the count again, test it to see what's the proper syntax

« previous php.db (#43403) next »