I\'m using SQL Server 2008;
Suppose I have a table \'X\' with columns \'Date1\', \'Date2\', \'Dateblah\', all of type DateTime.
I want to select the min valu
based on scalar function (from Tom Hunter):
SELECT ID, (SELECT MIN([date]) FROM (VALUES(Date1),(Date2),(Dateblah)) x([date])) MinDate FROM TableName