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

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Sort by:   newest | oldest | most voted

Great post.