select * from T where operator = (case when @type = 0 then @o1 else is not null end) 主要是想根据@type 用不同的条件当@type = 0 时 operator = @o 否则 operator is not null 请问各位大侠SQL语句怎么写,最好不要用字符串拼接
2 回答
阿波罗的战车
TA贡献1862条经验 获得超6个赞
select *
from T
where (operator = @o1 and @type = 0 ) or ( @type <> 0 and operator is not null )
- 2 回答
- 0 关注
- 647 浏览
添加回答
举报
0/150
提交
取消