-- 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.
*/
SELECT MAX (column_name)
FROM table_name
WHERE column_name NOT IN (SELECT Max (column_name)
FROM table_name);
Code Example |
---|
Sql :: codeigniter get sql query string |
Sql :: pivot |
Sql :: INITCAP in Oracle example |
Sql :: sql datitime to date |
Sql :: sql remove duplicates |
Sql :: PL SQL VARRAY of records |
Sql :: sql server delete table |
Sql :: NVL() Functions |
Sql :: QL HAVING Keyword |
Sql :: mysql locate |
Sql :: insert array into mysql column |
Sql :: what is having clause in sql |
Sql :: print hello world in sql |
Sql :: SQLSTATE[01000]: Warning: 1265 Data truncated for column |
Sql :: sql select inside select |
Sql :: import data from csv to sql server |
Sql :: mssql-cli usage |
Sql :: select database in mysql |
Sql :: sql server today minus n |
Sql :: sql example query |
Sql :: oracle chain rules |
Sql :: create foreign key postgres |
Sql :: how to join three tables in sql using joins |
Sql :: mysql limit order by |
Sql :: on update current_timestamp jpa |
Sql :: oracle tablespace usage |
Sql :: union vs union all in sql |
Sql :: oracle find foreign key dependencies |
Sql :: SQL order by string split length |
Sql :: mysql size of database |