《mysql 官方说明书》

mysql case when

 

 

select 
case when statusCode<=2 then '上海' 
when statusCode>2 then '河南' end write1
,case statusCode 
when '1' then '上海-1'
when '2' then '上海-2'
end write2
from (
select '1' as statusCode,'上海-浦东' as city union all 
select '2' as statusCode,'上海-徐汇' as city union all 
select '3' as statusCode,'河南-郑州' as city union all 
select '4' as statusCode,'河南-开封' as city 
)t

 

相关文章:

  • 2021-08-05
  • 2021-12-23
  • 2021-08-16
  • 2022-02-03
  • 2021-06-20
  • 2022-01-28
猜你喜欢
  • 2022-03-09
  • 2022-02-10
  • 2022-01-08
  • 2022-12-23
  • 2021-10-17
相关资源
相似解决方案