SQL取行最大值

时间:2021-12-07 15:31:17
create table T(A decimal(10,1), B decimal(10,1), C decimal(10,1), D decimal(10,1), E decimal(10,1)) insert T select -21.5,-15.0,-5.0, null, null union all select -5.5,-11.5,null, null, null union all select -1.0,-16.5,-10.5, null, null SELECT * FROM T select *, max_value=( select max(A) from( select A union all select B union all select C union all select D union all select E)tmp ) from T