How to use CASE in SQL , Syntax Error being shown
Posted
by Shantanu Gupta
on Stack Overflow
See other posts from Stack Overflow
or by Shantanu Gupta
Published on 2010-04-24T04:44:49Z
Indexed on
2010/04/24
4:53 UTC
Read the original article
Hit count: 416
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
© Stack Overflow or respective owner