I am not asking about the aggregate Min/Max functions here. I would like to know if there are functions to get the mix or max of two values as in:
SELECT Maximum(a,b)
FROM Foo
If table Foo contains
a b
1 2
4 3
Then the results should be 2, then 4.
I 开发者_如何学编程can do this with an IF or CASE statement, but you'd think there would be some simple math functions for this.
Thank you,
Daniel
There is not. You can write your own UDFs but UDFs can slow queries down. Another option is to UNPIVOT the data so you can use the aggregate function. But for small applications CASE is best.
精彩评论