I have a field of dates stored as DDDDMMYY and want to calculate the number of days between this date and the current date.
I am using WINSQL and DB2.
I get a result using the below statement
days(curdate())-days(date(substr(lsdate+100000000,2,4)||'-'||substr(lsdate+100000000,6,2)||'-'||substr(lsdate+100000000,8,2)))
but is it possible to use this as a WHERE clause, ie
WHERE days(curdate())-days(date(substr(lsdate+100000000,2,4)||'-'||substr(lsdate+100000000,6,2)||'-'||substr(lsdate+100000000,8,2))) < 10