Is there a Max function in SQL Server that takes two values like Math.Max in .NET?
Posted
by skb
on Stack Overflow
See other posts from Stack Overflow
or by skb
Published on 2008-09-23T22:52:03Z
Indexed on
2010/05/20
14:10 UTC
Read the original article
Hit count: 512
I want to write a query like this:
SELECT o.OrderId, MAX(o.NegotiatedPrice, o.SuggestedPrice) FROM Order o
But this isn't how the MAX function works, right? It is an aggregate function so it expects a single parameter and then returns the MAX of all rows. Does anyone know how to do it my way?
© Stack Overflow or respective owner