day(DATEINMONTH(today(),-1)) 本月
day(DATEINMONTH(MONTHDELTA(today(),-1),-1)) 上月
select
sum(r.ACCEPT_TWO_VOL) yhj,---月合计
sum(r.ACCEPT_TWO_VOL)/${day(DATEINMONTH(MONTHDELTA(reportDate,-1),-1))} rj
from PC_BSQ_MAIN_LINE_S_SHIFT r
where r.org_id = '${org_id}'
and to_char(r.PROD_DATE, 'yyyy-mm') ='${format(MONTHDELTA(reportDate,-1) ,'yyyy-MM')}'
group by to_char(r.PROD_DATE, 'yyyy-mm')