I found this on here by splattne, but couldn't post a comment asking the following question, so here it is.
-- the following expression calculates ==> max(@val1, @val2)
SELECT 0.5 * ((@val1 + @val2) + ABS(@val1 - @val2))
What would this formula look like to get the minimum?
What would this formula look like for 4 columns? (I know, more than one question.)