select if('${wd}'='按月',left(record_date,7),record_date) 日期,SUM(effective_dimission_quantity)/(sum(active_quantity)+SUM(effective_dimission_quantity)) 离职率from (select *,replace(replace(dept3_name_new,'工厂',''),'苏州','') 主体from app.mtr_produce_employee_summary_maWHERE dept3_name_new <>''and dept3_name_new like '%工厂%') MTRwhere 1=1-- ${if(len(qy)=0 || find("中心",qy)>0 ,""," and 主体 in ('"+qy+"')")}and if('${wd}'='按月',is_lastday in (1,2) and left(record_date,4)=left('${bt}',4),record_date between '${st}' and '${et}')GROUP BY if('${wd}'='按月',left(record_date,7),record_date)order by if('${wd}'='按月',left(record_date,7),record_date)但我在数据库是能执行的