select s.projectname as '项目名称',isnull(sum(CAST(s.moneys as numeric(18,2))),0) as '报销金额' from (
select s.projectname as '项目名称',isnull(sum(CAST(s.moneys as numeric(18,2))),0) as '报销金额' from (
select b.projectname as projectname, isnull(CAST(b.reimbursement as numeric(18,2)),0) as moneysfrom expensesheet_child b left join expensesheet a on a.id=b.expensesheet_id
where b.businessprojectcode!='' and b.projectname!='' and b.reimbursement !='' and a.del_flag=0
union all
select d.projectname as projectname,isnull(CAST(d.SumMoney as numeric(18,2)),0) as moneys
from travelexpense_child d left join travelexpense c on c.id=d.Travelexpense_id
where d.businessprojectcode!='' and d.projectname!='' and d.SumMoney !='' and c.del_flag=0
) s
group by s.projectname order by isnull(sum(CAST(s.moneys as numeric(18,2))),0) desc