I need to select all records from a table where date of insertion is less then 6 years from today.
we have a column in table having insertion time stamp.
currently I am using following query :
SELECT count(*) FROM TABLE1 WHERE APPLICATION_ID IN
(SELECT application_id FROM TABLE2
WHERE days(current timestamp)-days(LAST_UPDATE_DTTM) >= 'no of days in 6 years');
I am facing issue with number of days value. Because we may get 1 leap year in 6 year span and we may get 2 leap years.
Thank!!in advance. please help