好长时间不写sql了,今天群里问了一个问题:

我想得到的就是  2,3,4,就是低,5,6,7,8,9就是中,10,11....就是高,现在只知道zpcs,怎么得到高中低?
case when完成不同条件的显示

case 写的,decode不好写

首先是测试表

case when完成不同条件的显示

然后让不同的人显示不同

select user_name,
(case when user_name in ('孙丹华','孙国平') then 'ok'
 when user_name in ('孙静怡')  then 'ok2'
   else 'notok' end
) as 测试
 from sm_user where user_name like '孙%'

 case when完成不同条件的显示

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-07-30
猜你喜欢
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案