Monday 25 May 2015

MSSQL - SQLServer - How to Calculate Max of Multiple Columns







Here is my table:





I want to know what is the max of bonus, salary or gambling for each user
Here is the query that will do it:
select CustomerName,
   (select Max(Numbers)
    from (Values (Bonus), (Salary), (Gambling) ) as TblNum(Numbers))

From Table3











No comments:

Post a Comment