求SQL语句

I am old man 2020-02-23 04:03:42
各位大神求帮帮老年人,求H列和I列的SQL语句,或实现方法

...全文
17 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
吉普赛的歌 2020-02-23
  • 打赏
  • 举报
回复
select * 
, case when H>0 then H else maxValue end as I
from(
select *
, case 取值测试方式 when 'Type1' then Type1
                              when 'Type2' then Type2
                              when 'Type3' then Type3
end as H
, case when Type1>=Type2 and Type1>=Type3 then Type1 
          when Type2>=Type1 and Type2>=Type3 then Type2
  else  Type3 end as maxValue
from t
) as tt
I am old man 2020-02-23
  • 打赏
  • 举报
回复

27,579

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧