📜  sql max of two values - SQL 代码示例

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

代码示例1
-- For SQL Server >= 2008
SELECT [Other Fields],
  (SELECT Max(v) 
   FROM (VALUES (date1), (date2), (date3),...) AS value(v)) as [MaxDate]
FROM [YourTableName]

/* Note (from comments): From value(v), "value" is the alias for the 
 * virtual table and "v" is the name of the virtual column of the date values.
 */