I am trying to retrieve some records from table based on my query but it shows me an error
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ‘>
select vd.LedgerId,(CreditAmt-DebitAmt) AS NET, CASE NET
WHEN NET > 0 THEN 'Debit' WHEN NET < 0 THEN 'Credit' ELSE 'Nil'End
from dbo.vdebit vd INNER JOIN dbo.vCredit vc ON vd.LedgerId=vc.LedgerId
Thanks to both Wikser and Trey as I had some syntax problem that was bring into my notice by them and after that my query still had problem.
Issue was- Net was an alias to my column and when i was checking it in case statement it was not able to find out the same column.
ERROR
Correction Made