This might be easier to interprit/*--Creates a tmp data sourceselect *into #tmpFrom(Select 1 as loadID,7 as load_1, 1 as load_2, 3 as load_3, 9 as load_4 Union Allselect 2,66,4,22,33 Union Allselect 3,2,41,2,3 Union Allselect 4,77,141,32,13 Union Allselect 5,23,411,23,113 ) a*/select loadID,(Select max(aa.mycol) from (Select a.Load_1 as MyCol Union AllSelect a.Load_2 Union AllSelect a.Load_3 Union AllSelect a.Load_4 ) aa) as MaxValuefrom #Tmp a