Answers for "sql max of two values"

SQL
0

sql max of two values

-- 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.
 */
Posted by: Guest on December-30-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language