sql sum group by is returning null code example
Example 1: sql group by sum
Select LastName, FirstName, Sum(LeaveDays), Max(age)
From EmployeeProjects
Where StartDate > '2020-01-01'
Group By LastName, FirstName
Example 2: sql sum with group by left join Oracle query
select
q.sp_question_id,
count(p.project_id) as projectCount,
sum(p.funding) as amount,
round(sum(p.funding)/sum(sum(p.funding)) over() *100) as percentTotal
from questions q
left join objectives o on
o.sp_question_id = q.sp_question_id
and o.fiscal_year = 2014
left join projects p on o.fiscal_year = p.fiscal_year and o.sp_objective_id = p.sp_objective_id
left join funders f on p.funder_id = f.funder_id and f.funder_short_name ='foo'
where q.fiscal_year = 2014
group by q.sp_question_id
order by q.sp_question_id;