语法:
case when 条件 then 值1 else 值2 end
示例:
select (case when t.project_id=‘0’ then 1 else ln(t.project_id) end) LN from MES2_BYD_SHOPORDER t
当t.project_id等于0时,返回1,否则返回ln(t.project_id)。这样可以防止ln()中参数为0而报错。
结果:
数据库中条件判断Case的用法

相关文章:

  • 2021-12-16
  • 2022-02-08
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-12
  • 2021-05-06
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2023-02-08
相关资源
相似解决方案