Taking the greatest date from 3 Date Columns
Hi All,
I have 3 Date/Time columns in my table:
DateTime_1,
DateTime_2,
DateTime_3
I'm trying to select the maximum or greatest date from any of these 3 columns. Any of the columns can be null. I've tried using a combination of the coalesce and greatest functions to get the maximum date value. When I use a coalesce on the 3 columns it works fine but when I nest the coalesce in the greatest function, ie Greatest(Coalesce(...)) it is taking a null value. Should I include an nvl on each column?
Any help would be appreciated.
Thanks,
Ed