Got some problem after using inner join, this is my query.
select sum(total) as total,id
from
(
select * from midsemester union
select * from endsemester
) as vij
group by id
This is the table:
Table name: midsemester
ID Grade ---------- 1 10 2 30 3 40
Table name: endsemester
ID Grade ---------- 1 30 2 40 3 20
and i need to sum these table to new table called total. This is the results that i was hoping.
Table name: total
ID Grade ---------- 1 40 2 70 3 60
I actually just need to sums up the grade's value using the id for the 3rd table. And tried several times using inner join, it's working. But when i re-checked the 3rd table again, the record was empty. Would appreciate any help, thanks! :)