MySQL - Subquery returns more than 1 row
|Added at||2017-01-02 17:01|
Firstly, here is an example of a table that I'm trying to manipulate :
I want to calculate the percentage of each values of the column_a when the column_b has the same value.
For example, when column_b = 1, 24+53+12=89 so we will get the following percentages :
This is working when I use "WHERE" to indicate the value of the column_b as you can see with this request:
But, when I try to calculate all percentages for each value of the column_b, it's still not working.
I have tried to do this with a 'GROUP BY' but the error "Subquery returns more than 1 row" occured :
I understand why I have this error because the second SELECT returns 3 values and it's not possible to divide these successively. So, how can I do what I want please ?