I got a Oracle Sql code where I want the dates.
select abc,eff_dt
from xyz
where eff_dt between 'a' and 'b'
I am looking to get dates from previous 3 months.
You can truncate the current date to the first day of the month, then use interval arithmetic. Probably you want to use half-open intervals rather than computing the last day of the month (this is usually safer, especially if your dates have a time portion):
where eff_dt >= trunc(sysdate, 'mon') - interval '3' month
and eff_dt < trunc(sysdate, 'mon')
Of course this assumes that eff_dt
of a date
-like datatype.