I'm using a pass thru query in Excel to convert a date MBODDT (20150206) to 42041. I use the following statement:
CASE WHEN MBODDT = 0 THEN 0 ELSE DAYS(CURDATE()) - DAYS(DATE(SUBSTR(MBODDT,1,4)||'-'||SUBSTR(MBODDT,5,2)||'-'||SUBSTR(MBODDT,7,2))) END
Surely there is an easier statement than having to deconstruct MBODDT.
I've looked everywhere with no luck.
I've found SELECT DAYS(CURRENT DATE)-DAYS(DATE('1900-01-01')) AND TRIED TO SUBSTITUTE MBODDT for CURRENT DATE bit it wants MBODDT to be in the format 'YYYY-MM-DD'.