简体   繁体   English

我在此SQL中缺少什么

[英]What am I missing from this SQL

What am I missing in the below: 我在下面缺少什么:

WHERE sls.SalesStatus IN (1,2,3)  
AND hdr.DeliveryDate <> (CASE ISNULL(sls.SalesStatus,'1')

I am getting this error message: Incorrect syntax near ')' 我收到此错误消息:')'附近的语法不正确

Thank you! 谢谢!

Your code doesn't make sense. 您的代码没有意义。 You could mean this: 您可能的意思是:

WHERE sls.SalesStatus IN (1, 2, 3) AND  
      hdr.DeliveryDate <> COALESCE(sls.SalesStatus, '1') 

However, a column named DeliveryDate is an unlikely candidate for a comparison to either a string or the string value '1' . 但是,一个名为DeliveryDate的列不太可能用于与字符串或字符串值'1'

It is possible that you mean something like: 您可能会说类似:

WHERE sls.SalesStatus IN (1, 2, 3) AND
      hdr.DeliveryDate <> (CASE ISNULL(sls.SalesStatus,'1') WHEN '1' THEN ? ELSE ? END)

This is just speculation, but you would need to complete the logic. 这仅仅是推测,但是您需要完成逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM