SELECT CALENDAR_DATE,SUB_SYSTEM ,LR_RATIO FROM dwr.DWR_T_FAC_POWER_CONSUMPTION where 1=1${if(to_date(day1,'yyyy-mm-dd'))=trunc(sysdate,'dd')," and LR_RATIO in (selectLR_RATIO from dwr.DWR_T_FAC_POWER_CONSUMPTION where CALENDAR_DATE = trunc(sysdate,'dd') -1)"," and in LR_RATIO in (selectLR_RATIO from dwr.DWR_T_FAC_POWER_CONSUMPTION where CALENDAR_DATE = to_date(day1,'yyyy-mm-dd')"}