I would like to conduct surveys (2 or more options) and put the results in a table. I just want to know how I could count the results in a sql query.
Even more, should I do the math in the query or just use PHP to do the math?
Example
Table of questions
question_id (int) question (text) answer_1 (varchar) answer_2 (varchar) answer_3 (varchar) etc...
Answer Table
answer_id (int) question_id (int) answer (int) The answer they chose. (1, 2, 3, etc.)
How should I / I calculate the results?
Edit: using MySQL, PHP. The difference between the answers (45% said blah, 50% said blah blah, 5% said they were flea). Not for homework, Im EE, not CS
math sql php mysql
Bduelz
source share