目前,我的查询字符串如下所示,
http://localhost:49442/Orders/?$count=true&$filter=not%20(Freight%20eq%202.3)%20and%20(startswith(tolower(CustomerID),%27b%27))&$skip=0&$top=12
但是这里非操作员只过滤货运列。但是我想通常使用这个非运算符来过滤Freight和CustomerID。
目前,我的查询字符串如下所示,
http://localhost:49442/Orders/?$count=true&$filter=not%20(Freight%20eq%202.3)%20and%20(startswith(tolower(CustomerID),%27b%27))&$skip=0&$top=12
但是这里非操作员只过滤货运列。但是我想通常使用这个非运算符来过滤Freight和CustomerID。
很难确定您的预期表达方式,因为它介于两者之间:
如果您只想排除同时满足以下两个条件的行:
然后你可以通过重新排列括号来做到这一点,下面和说的一样:
“排除客户以b开头的订单,但前提是运费是2.3”
http://localhost:49442/Orders/?$count=true&$filter=not(Freight eq 2.3 and startswith(tolower(CustomerID),'b'))&$skip=0&$top=12
相反,如果您想排除所有客户以“b”开头的订单,并且还排除运费为 2.3 的所有其他订单,那么您必须在查询中指定两次
这与:“排除客户以 b 开头的订单,或者运费为 2.3 的订单”
http://localhost:49442/Orders/?$count=true&$filter=not(Freight eq 2.3) and not(startswith(tolower(CustomerID),'b'))&$skip=0&$top=12