Greg Dodd tries out some new syntax:
Have you ever had 2 columns in a table that you need to select the maximum value from? Not the maximum value from each column, but the biggest value after comparing the columns?
Usually where I have this problem, I’d use a CASE statement, but there’s another way.
I do like GREATEST()
and LEAST()
(or argmax/argmin if you’re used to those terms), though Greg does include how you can get the same functionality in versions prior to SQL Server 2022.