LinksUp (9/2/2013)
vignesh.ms (9/2/2013)
is there any other way ?This way is fine. It just needs to be modified slightly to handle nulls.
Why would you need to handle nulls? Null won't be greater than anything.
I reviewed the results ans checked the need for a null validation, however it's not needed on all columns and date zero is possible.
SELECT a, b, c, CASE WHEN a >= ISNULL(b, CAST( 0 AS DATETIME)) AND a >= ISNULL(c, CAST( 0 AS DATETIME)) THEN a
WHEN b >= c THEN b
ELSE c END
FROM sample