I need to get the difference in days between two dates in DB2. I tried a couple of different queries, but nothing works. So basically what I need is something like this.
SELECT DAYS (CURRENT DATE) - DAYS (DATE(CHDLM)) FROM CHCART00 WHERE CHSTAT = '05';
I know that if I delete CHDLM and set a date like "2012-02-20", it works, but I need to be able to run this against this field in the table. I am also trying to fulfill this request, which was provided to me by a friend, also does not work.
select days (current date) - days (date(select concat(concat(concat(concat(left(a2.chdlm,4),'-'),substr(a2.chdlm,4,2)),'-'),right(a2.chdlm,2))) from sysibm.sysdummy1 a1, chcart00 a2 where chstat = '05';
Please any help would be greatly appreciated. Thanks
jorame
source share