📌  相关文章
📜  sql 获取最新的 2 个日期时间 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:29.685000             🧑  作者: Mango

代码示例1
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