Page 1 of 1

counting votes

Posted: Thu Jun 29, 2006 1:54 am
by itsmani1
I have table named votes and there is a field "cnt" in it where votes are casted. i want to count all votes against all entries? how can i do so?

thanks.

Posted: Thu Jun 29, 2006 3:00 am
by JayBird

Code: Select all

SELECT COUNT(`cnt`) as `total` FROM `votes` GROUP BY `cnt`
Something like that should do it without knowing your full table structure

Posted: Fri Jun 30, 2006 7:19 am
by itsmani1
its giving me all the vots, i need total not all votes.

Posted: Fri Jun 30, 2006 7:50 am
by jamiel

Code: Select all

SELECT SUM(`cnt`) as Total FROM `votes`

Posted: Fri Jun 30, 2006 8:29 am
by itsmani1
thanks much.