各位朋友们,请教一下SQL该怎么改写 where sj >= to_date('${startDate}-1 00:00:00','yyyy-mm-dd hh24:mi:ss' ) ${if(startDate==FORMAT(today(),'yyyy-MM'), "and sj <= to_date('"+FORMAT(today(),'yyyy-MM-dd')+" 23:59:59','yyyy-mm-dd hh24:mi:ss' )", "and sj<= to_date(to_char(last_day(to_date('"+startDate+"-1','yyyy-mm-dd')),'yyyy-mm-dd')||' 23:59:59','yyyy-mm-dd hh24:mi:ss' )" )} 这是我写的本月时间的语句,字段sj的格式是yyyy-mm-dd hh:mm:ss,输入的参数startDate为yyyy-mm,现在增加需求要算同比,我按照之前的格式改写为去年同月,却怎么也没成功,来请教一下各位朋友们,这样该怎么改写 |