Reputation: 382
I am trying to convert:
My statement is:
SUM(CASE [Apr] WHEN ([Apr] < 0) THEN -1 WHEN ([Apr] >= 0) THEN 1 ELSE NULL END) as Apr
[Apr]
is an int which accepts Nulls.
Any ideas why this is not working?
Upvotes: 3
Views: 6784
Reputation: 25489
SUM(CASE WHEN ([Apr] < 0) THEN -1 WHEN ([Apr] >= 0) THEN 1 ELSE NULL END) as Apr
Lose the [Apr] after Case
Upvotes: 1
Reputation: 7722
Remove [Apr]
after CASE
when doing comparisions in WHEN
SUM(CASE WHEN ([Apr] < 0) THEN -1 WHEN ([Apr] >= 0) THEN 1 ELSE NULL END) as Apr
Upvotes: 8