select aaa.Plant,aaa.date,sum(aaa.Actual_hours) as num,SUM(aaa.Area_total_RT) as num1 From(
select Plant,date,Actual_hours,Area_total_RT from S_Basic
where 1=1
${if(len(year) == 0,"","and year(Date) in ('" + year + "')")}
${if(len(month) == 0,"","and month(Date) in ('" + month + "')")}
${if(len(plant) == 0,"","and plant in ('" + plant + "')")}
union all
select Plant,date,Actual_hours,Area_total_RT From S_QUA
where 1=1
${if(len(year) == 0,"","and year(Date) in ('" + year + "')")}
${if(len(month) == 0,"","and month(Date) in ('" + month + "')")}
${if(len(plant) == 0,"","and plant in ('" + plant + "')")}
)aaa
group by aaa.Plant,aaa.Date
已在线下解决。