我正在尝试添加两个带有onyl负值的select语句,这些是语句:
SUM(CASE WHEN LinkAcc = '8420000' THEN amount < 0 END)
SUM(CASE WHEN LinkAcc = '8400000' THEN amount < 0 END) AS Payments
我试过了:
SUM(CASE WHEN LinkAcc = '8400000,8420000' THEN amount < 0 END) AS Payments
答案 0 :(得分:4)
THEN amount < 0
没有多大意义。如果我理解正确,你想要的是:
SUM(CASE
WHEN LinkAcc IN ('8420000','8400000') AND amount < 0
THEN amount
END) As Payments