CodePudding user response:
CodePudding user response:
select *
That case when H> 0 then H else maxValue end as I
The from (
Select *
, case test values when 'Type1 then Type1
When 'Type2 then Type2
When 'Type3 then Type3
End as H
The case when Type1 & gt;=Type2 and Type1 & gt;=Type3 then Type1
The when Type2 & gt;=Type1 and Type2 & gt;=Type3 then Type2
The else Type3 end as maxValue
The from t
) as tt