I have a survey with many objectives for assess from 1 to 5 in my web page. I send the survey to my database in my table of survey. For example
obj1value | obj2value | obj3value ... | obj17value |
I have a value for every survey.
Now I need to do some charts for present a report of the survey. I need to add up the totals for each objective. I have this query
SELECT SUM(obj1_value) AS objective1, SUM(obj2_value) AS objective2, SUM(obj3_value) AS objective3, FROM tbl_survey
I have this till objective17 and the query returns
| objective1 | objective2 | objective3 |
| --- | --- | --- |
| 17 | 12 | 5 |
But I need to change the query like this
_objective_ | _Value_
objective1 | 17
objective2 | 12
objective3 | 5
Objective17 | n
Someone can help me with the query to optimize because in this way I can convert the table php in json and took a bar chart library so easy.
Thank you