select name ,greatest(num1,num2,num3,num4) as max_num -- 最大值 ,least(num1,num2,num3,num4) as min_num -- 最小值 from ( select 'a' as name,1 as num1, 3 as num2, 2 as num3,4 as num4 ) t1 ;
select name ,greatest(num1,num2,num3,num4) as max_num -- 最大值 ,least(num1,num2,num3,num4) as min_num -- 最小值 from ( select 'a' as name,1 as num1, 3 as num2, 2 as num3,4 as num4 ) t1 ;