Home > database >  Strives for the SQL statement
Strives for the SQL statement

Time:09-22

Everyone a great god to help the elderly, for H column and I list of SQL statements, or implementation method

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
  • Related