📅  最后修改于: 2022-03-11 15:05:29.685000             🧑  作者: Mango
SELECT ID,
CASE WHEN
COALESCE(Date1, '1/1/1973') > COALESCE(Date2, '1/1/1973') -- COALESCE is to ensure comparison works when 1 is nullable
THEN Date1
ELSE Date2
END AS MostRecentDate
FROM Table