Toad World® Forums

Case statement not working

I have a simple case statement that I am attempting to use to SUM up product line item amounts. In some cases, depending on the product code, the amount should be subtracted. This is the statement I’m using:

SUM(CASE WHEN d.NACSCD in (‘900’,‘901’,‘902’,‘903’,‘904’,‘905’,‘906’,‘907’,‘908’,‘909’) THEN -1 * d.GROSSAMT_WEXBASIS ELSE d.GROSSAMT_WEXBASIS END)

Only it still appears to be adding the discount product codes. Am I missing something in the syntax?