Re: mysql question.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
         I try your SQL statements. There is no problem on your SQL syntax 
and you can use alias in the order by clause.:)

 $SQL = "SELECT EMail,count(EMail) AS repeated FROM mena_guests WHERE
Voted = 'yes' GROUP BY EMail ORDER BY repeated  LIMIT
$startingID,$items_numbers_list";


-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

""Dimiter Ivanov"" <erazorbg@xxxxxxxxx>, haber iletisinde sunlari 
yazdi:7cc8007f0704030620n7a6fd383qe6ffa5d5437b2ec7@xxxxxxxxxxxxxxxxx
> On 4/3/07, Me2resh Lists <me2resh.lists@xxxxxxxxx> 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 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux