Antwort: [PHP-DB] Tally up a field in a database...

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

 



>  I have a field in a DB that has either 0 or 1 as the value.
>  It's part of a survey I'm doing.
> 
>  I want to be able to take that field and tally up all the results, 
giving
>  a total for the user to see.
>  I know it's simple, but the friday bug has gripped me...
> 
>  so if 30 users did the survey, and 12 selected 1, I want the result to
>  show '12'
> 
>  Any ideas?
> 
>  ***********************************************************************
>  The information contained in this e-mail message is intended only for
>  the personal and confidential use of the recipient(s) named above.
>  If the reader of this message is not the intended recipient or an agent
>  responsible for delivering it to the intended recipient, you are hereby
>  notified that you have received this document in error and that any
>  review, dissemination, distribution, or copying of this message is
>  strictly prohibited. If you have received this communication in error,
>  please notify us immediately by e-mail, and delete the original 
message.
> ************************************************************************
> 
> 

You can do that with SELECT SUM(<fieldname>) FROM ..... (at least with 
MySQL).

Thomas

===============================================
Thomas Sinka
mobil: +49 163 3 23 12 72
mailto: thomas.sinka@it-choice.de

IT-Choice Software AG
Kaiserstraße 160-162, 76133 Karlsruhe, Germany
Tel.: +49(0)721-85 006-0, Fax: +49(0)721-85 006-77
www.it-choice.de, info@it-choice.de

Amtsgericht Karlsruhe, HRB 9060
USt-Id Nr.: DE 812 950 635
Vorstand: Mirko Ketterer (Vorsitzender),
Stephanie Lehmann, Dirk Ludwig
Aufsichtsratsvorsitzender: Horst Gann

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