SELECT * FROM EDW_FR_SHIP_INCOME WHERE 1=1 ${IF(START_MONTH==FORMAT(TODAY(),"yyyy-MM")," AND STATE_DATE>='"+CONCATENATE(START_MONTH,"-01")+"' AND STATE_DATE<'"+TODAY()+"'"," AND STATE_DATE>='"+MONTHDELTA(FORMAT(CONCATENATE(START_MONTH,"-01"),"yyyy-MM-dd"),-1)+"' AND STATE_DATE<='"+DATEDELTA(FORMAT(CONCATENATE(START_MONTH,"-01"),"yyyy-MM-dd"),-1)+"'")}