[英]Case inside where clause
I want to add constraint to where clause 我想在where子句中添加约束
What I do is this 我是这个
and case @CCY when 2 then
not(s1.Number = '810' and s2.Number = '810')
end
It returns error How to handle this? 返回错误如何处理? Thanks in advance 提前致谢
You simply want to get rows where s1.Number and s2.Number are <> 810 (if @CCY=2): 您只想获取s1.Number和s2.Number为<> 810的行(如果@ CCY = 2):
WHERE @CCY <> 2 OR
NOT ( s1.Number = 810 AND s2.Number = 810 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.