Hello, I want to delete data from a table where Created_Date older than first day of the year 2 years from today. For example, today is 4/4/2016, I want to delete data older than 1/1/2014.
Can someone provide me the SQL for it?
where Created_Date < add_months(trunc(current_date, 'y'), -12)
Get January 1st of the current year and subtract one year.
Created_Date < add_months(trunc(
This SQL below also worked, but I like your way.
('01-01' || '-' ||TRIM(( EXTRACT (YEAR FROM CURRENT_DATE) - 2) )AS DATE FORMAT 'mm-dd-yyyy');