I'm trying to perform calculations in T-SQL, but am having some problems with it. Here is what I'm trying to do:
DECLARE @CNT money
SELECT @CNT = 0
Select Amount,
case
when Service like 'pay_in' then SET @CNT = @CNT + Amount
when Service like 'pay_out' then SET @CNT= @CNT - Amount
end
from Payment where isActive = 1
select @CNT
Due to my poor knowledge of T-SQL syntax I'm stuck here, and would be very thankful if someone can push me in the right direction. Thank you!