Re: Generating results of a survey
| From: | David Robley | Date: | Fri, 04 Aug 2000 02:19:56 +0000 |
| Subject: | Re: Generating results of a survey | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10062@lists.php.net to get a copy of this message | ||
On 3 Aug, Mike Tuller wrote:
> Hello all,
> Can anyone point me to an example of how to display the results of a survey
> where the data is stored in MySql with everything calculated. I can't seem
> to find anything in any of my books or on the web.
>
> Example output would be something like:
>
> Did you enjoy the class?
> yes 50 no 10
>
>
> Thanks,
> Mike
>
>
Very simply, use COUNT.
A query like SELECT COUNT(*) AS yay FROM table WHERE vote='YES'
will return one row with one field yay containing the number of 'yes'
votes.
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA