我有一个带有X和Y坐标列的对象列表。
当变量值大于5804400时,我只想选择Y坐标值大于5804400的对象。
这是我的尝试,但是SQL不喜欢它。
Select * from Panels p
where case when @Val > 5804400 then p.Y > 5804400 else p.Y < 5804400 end
您不能以case
这种方式使用表达式,但可以将其重写为:
Select * from Panels p
where (p.Y > 5804400 and @Val > 5804400) or (p.Y < 5804400 and @Val <= 5804400)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句