Me2resh Lists,

with my limited SQL experience it appears that you're asking to sort the query without the proper results from the query. Your SELECT statement below should return the following:


Non-duplicate rows of mena_guests.EMail where mena_guests.Voted is yes, starting at $startingID up to $items_numbers_list records.

Since the DISTINCT clause is used, only non-duplicate records are returned, and there is no count of the rows duplicated for each distinct EMail. Thus you can't sort the result by any count. I think the select statement that you really want is this...

SELECT EMail, COUNT(*) FROM mena_guests WHERE Voted = 'yes' GROUP BY EMail LIMIT $startingID, $items_numbers_list


The "group by" will cause the DISTINCT effect AND you'll be able to see how many duplicates there were for each distinct EMail.

Hope this helps,

Dan Luevano

[EMAIL PROTECTED] wrote:

mysql question.
        43402 by: Me2resh Lists

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 ?


----------------------------------------------------------------------

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

Reply via email to