Re: counting a value

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

 



SELECT favourite_nb, COUNT(*) AS tally
FROM mytable
GROUP BY favourite_nb

HTH
Ignatius
_________________________
----- Original Message -----
From: "js" <james@xxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Friday, January 30, 2004 19:07
Subject:  counting a value


i want to know what i can use to count the number of times a value appears
in a column listing where different values are listed. for example, say in
the column of Favorite Number we have 100 students, and for each student his
or her own row. and each student can pick a number from 1-10. So, we have a
column of 100 rows and each field can contain either 1-10.    Now, i want to
know how can i count the number of times  lets say the #2 appears in this
list and give that count a number. so if #2 appears 43 times in that column,
then i want it to say "2 is listed 43 times."  how do i do this? thank you
for your help with my beginner newbie questions.
-james

-- 
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