If I have a table that (among other columns) has two DATETIME columns, how would I select the most recent date from those two columns.
Example:
I think the accepted answer is the simplest. However, I would watch for null values in the dates...
SELECT ID, CASE WHEN ISNULL(Date1,'01-01-1753') > ISNULL(Date2,'01-01-1753') THEN Date1 ELSE Date2 END AS MostRecentDate FROM Table