February 25, 2012 at 12:22 am
I have the Employees Table which canting the following data
Empcode Basic Pay H.Rent
65 800 800
89 800 800
96 750 1000
I want if the empcode is differ and Basic Pay and House Rent Amount Same then “CHECK IT” Else
“OK”
somebody help me which condition is apply here Please
February 25, 2012 at 7:02 am
Here is something to get you started
CREATE TABLE #t(Empcode INT, BasicPay Money, Rent Money)
INSERT INTO #T
SELECT 65, 800, 800 UNION ALL
SELECT 89, 800, 800 UNION ALL
SELECT 96, 750, 1000
SELECT Empcode,'Action '=
CASE
WHEN BasicPay = Rent THEN 'Check it'
WHEN BasicPay <> Rent THEN 'OK'
END
FROM #t
Results
Empcode Action
65Check it
89Check it
96OK
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply