Understanding the Difference Between MAX() and GREATEST() in SQL Server

SQL Server 2022 introduced the GREATEST() function that returns the maximum value from a list of values. You may be thinking, “but there’s already a MAX() function that returns the maximum value, so why the need for another function that does the same thing?”.

Well here’s the thing – they don’t do the same thing. They’re actually quite different functions, used in different scenarios.

If you’re wondering what the difference is between the MAX() and GREATEST() functions, read on to find out.

Continue reading