RE: [PHP] select the most repeated value in a field
| From: | Maxim Maletsky | Date: | Thu, 24 May 2001 07:51:38 +0000 |
| Subject: | RE: [PHP] select the most repeated value in a field | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-54176@lists.php.net to get a copy of this message | ||
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)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Jacky [mailto:jacky@activelifestyle.com]
Sent: Friday, May 25, 2001 4:03 AM
To: php-general@lists.php.net
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
jacky@activelifestyle.com
"There is nothing more rewarding than reaching the goal you've set for
yourself"