Reputation: 308
i have a mysql query that looks like this :
select (pondérée_note*100)/pondérée as b
from answers
where answers.question_id in (select id
from questions
where categorie_id = 3)
and user_id = 5
The query returns a table b :
b
50
50
13
25
I want to do the sum of those values By
select SUM(query);
but it doesn't work because of a syntax error.
is it possible to sum a query like this ? Thanks.
Upvotes: 0
Views: 40
Reputation: 4806
Try this:
select sum((pondérée_note*100)/pondérée) as sumb
from answers
where answers.question_id in
(select id from questions where categorie_id = 3) and user_id = 5
Upvotes: 1