I have two fields (day1 and day2) with the same value that aren't equal to each other.
The 2nd date is 3915-11-30, you forgot to subtract 1900 from the year:
CAST ((EXTRACT(YEAR FROM ADD_MONTHS(snap_dt,1))-1900)*10000+EXTRACT(MONTH FROM ADD_MONTHS(snap_dt,1))*100 + 1 AS DATE)-1 AS day2,
In don't think you actually need this calculation, there's
Thanks! I wouldn't have guessed that casting as a date adds 1900 to the year.
Also just saw your earlier posts on LAST_DAY:
Much more elegant, thanks again!