select *,
(select sum(planmoney) as pl from table as inn where project_id = table.project_id and inn.date <= table.date) as plan_total,
(select sum(actualmoney) as act from table as inn where project_id = table.project_id and inn.date <= table.date) as act_total
from table order by project_name,date;

按项目名称和月份分组,按计划金额与实际金额累加