how to minus 2 days from the date field
Posted on 2005-04-28
database consist of: file_name and post_date
file_name = "abc20050426.txt"
post_date = "28-APR-2005 03:59:48"
I would like to minus 2 days from the post_date, and convert to "yyyymmdd"
then compare it to the date on the file_name.
select file_name, post_date from table
where to_char(post_date, 'DD-MON-YYYY') >= (sysdate -7)
and ((substr(file_name,4,8) = to_char(post_date, 'YYYYMMDD') = (sysdate -2));