SQL Server: Find MAX value from Multiple Columns

In this post, I am sharing one T-SQL Script to find MAX value from Multiple columns in SQL Server.

At our table, we have three different updated date columns and require to find the one max value out of this three column.

I have worked around this and tested different solution for performance aspect also because I executed this script over the 10000000 production data and out this all different solutions, I am sharing one of the best solution here.
I have tested different solutions like, UNPIVOT, UNION, InnerQuery.
This T-SQL script solution work with only same type of columns.

Let’s First, create sample table and data:

T-SQL Script to Find MAX Value from three different Date Columns:

The Result:

Max Value From Multiple Columns SQL Server

Anvesh Patel

Leave a Reply

1 Comment on "SQL Server: Find MAX value from Multiple Columns"

Notify of
Sort by:   newest | oldest | most voted

Great post.