Re: Tally up a field in a database...

From: Date: Fri, 09 May 2003 10:08:01 +0000
Subject: Re: Tally up a field in a database...
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27607@lists.php.net to get a copy of this message
On Friday 09 May 2003 17:39, Tristan.Pretty@risk.sungard.com wrote: > 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' select sum(field) from table; OR select sum(field) as total from table; For further info refer to your DBMS manual. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db ------------------------------------------ /* You tread upon my patience. -- William Shakespeare, "Henry IV" */

« previous php.db (#27607) next »