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)