I have a table with scores in columns with 1,0,and NA for answer as results. The data in the table will continue to grow as more scores are submitted for all three answer.
|id | username | answer1 | answer2 | answer3 |
--------------------------------------------
| 1 | John | 1 | 0 | 1 |
| 2 | Mike | NA | 1 | 1 |
| 3 | Jill | 1 | NA | 0 |
| 4 | Mary | 1 | 1 | 1 |
I am trying to create a select query that will display the results listed below (Total1 will sum all 1s, Total 2 will sum all Os, and Totals will sum all NAs) from the table above. I am using a MySQL database.
|questions | total_1 | total_0 |total_NA|
----------------------------------------
| answer1 | 3 | 0 | 1 |
| answer2 | 2 | 1 | 1 |
| answer3 | 3 | 0 | 0 |