use GROUP BY


SELECT 
        result,
        COUNT(result) AS res_count
FROM
        result
GROUP BY
        result
ORDER BY
        res_count
        DESC
;

Sincerely, 

 Maxim Maletsky
 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com



-----Original Message-----
From: Jacky [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 25, 2001 4:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] select the most repeated value in a field


Hi people
How do i query to select the most repeated values in a field, say if I hacve
list of values as a,b,c,d,e to be submitted to a field call "result" in a
table. And I want to know which value appear most in that "result" field
amoung all records.
cheers
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you've set for
yourself"


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to