Answer the question
In order to leave comments, you need to log in
How to find the sum of averages?
How to get the amount in one line for one field (budget). But there is a problem, in the table the projects are repeated several times, only the contract changes, but the budget remains the same. When I use order by iid (by project), I get the sum of project budgets
select AVG([budg]) as iid_avg
from [projects]
where budg is not null
group by [iid]
Answer the question
In order to leave comments, you need to log in
From what I understood:
select sum(budget) from (
select distinct project, budget from projects
) p;
budget stays the sameWhy calculate the average for the same values? The average will be this value. So you need to take one line for each
iid
.SELECT SUM(one_bug)
FROM( SELECT DISTINCT iid, bugs AS one_bug FROM projects ) AS DB
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question