I am trying to pull in data based on a date field with the following logic: where (case when to_char(sysdate,'d') < 6 then a.dte_entered between last_day(ADD_MONTHS((SYSDATE-1),-3)) and TRUNC(SYSDATE - 1) else a.dte_entered between last_day(ADD_MONTHS(SYSDATE,-2)) and TRUNC(SYSDATE - 1) end)
Example: if today's date is October 5, then I need all data that falls between August 1 and October 4 if today's date is October 10, then I need dates between September 1 and October 9