我无法在where子句中获取case语句以使用参数

时间:2019-07-22 16:03:58

标签: sql-server case ssms where-clause

我正在制作一个报告,使我可以查看信息,具体取决于我是否已支付运费。

more = WebDriverWait(driver, 10).until(
    expected_conditions.presence_of_element_located((By.XPATH, "//a[contains(@class,'m-more')]")))
if not more.is_enabled():
    driver.find_element_by_xpath("//a[contains(@class,'modalClose')]").click()
more.click()

1 个答案:

答案 0 :(得分:3)

CASE表达式(即THENELSE之后的谓词)必须是文字值,不能是另一个逻辑表达式。您可以重新定义CASE逻辑,如下所示:

SELECT ...
FROM ...
WHERE
    (@Billed = 1 AND Freight > 0) OR
    (@Billed = 0 AND Freight = 0) OR
    Freight >= 0;