Page 1 of 1
counting diffrent values of a field
Posted: Sun Jun 27, 2004 9:25 am
by pelegk2
can i in 1 select count all the values of a field that say equals 35
and how many are not?
thnaks in advance
peleg
Try this
Posted: Sun Jun 27, 2004 9:44 am
by Calimero
FIRST you weren't clear is this MySQL table field or form processing textfield
Select count(column_name) from table_name where colum_name2='35' OR colum_name2<>'35';
OR you can use != instead of <>
Now you got the results, but decide on grouping to make them of any use for you
FOR EX.
//add this in the end of the MySQl statement
GROUP BY column_name2
Do report if this was usefull

Posted: Sun Jun 27, 2004 10:12 am
by John Cartwright
[mysql_man]count[/mysql_man]
Posted: Mon Jun 28, 2004 3:18 am
by pelegk2
but i want to count say :
all the cases that colum_name2=33
and all the cases that colum_name2=45
and know of each type how many i have
Posted: Mon Jun 28, 2004 3:41 am
by feyd
try
Code: Select all
SELECT column_name, COUNT( column_name ) count FROM table_name GROUP BY column_name
seems to work for me..