sql 里经常用的where语句中可以使用case when

常用的

  select * from tb where a= case when b>0 and b<100 then 1 when b>=100 then 2 else 3 end

  满足条件执行大于某个值,不满足不执行查询

 select * from tb   where  ((case when isnull([a],'')<>'' then convert(numeric(10,2),isnull([a],'0')) else 4000 end)>100)

  

相关文章:

  • 2021-06-10
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-03-01
猜你喜欢
  • 2022-12-23
  • 2021-07-30
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
相关资源
相似解决方案