I’ve got some simple survey data that I’d love to have a hand with. I work with PHP/MYSQL.
Basically, the survey has 20 questions with 3 possible answers for each: Y, N and N/A. I want to ‘score’ each survey at the end using the formula: Y/(Y+N).
The Question: How do I actually come up with the ‘SCORE’ column at the end? Using a SQL query or using PHP (somehow)? Is there some kind of COUNTIF function in MYSQL like Excel has?
A query like: COUNTIF(“Y”, Column1:Column20) would be awesome—if it existed!
Suggestions appreciated!
(I guess I’m looking for as much procedural advice as technical with this question).
Thanks
Terry
Q1 Q2 Q3 Q4 Q5 SCORE
---------------------
Person1 - y n y n n/a 50%
Person2 - y y y y y 100%
Person3 - y y y y n/a 100%
No tricks. A long winded SUM(CASE …)
It’d be easier with one row per question… especially when you add more questions. See First Normal Form