SQL Query
-
Most of the time there are two/three record in the table. How can you do it in SQL IF Status = 1 or status = 0 THEN Desc = "In Progress" TabID Status T1 1 T1 0 If Status = 1 or status = 1 THEN Desc = "Ok" TabID Status T1 1 T1 1 If status = 0 or status = 0 THEN Desc = "failed" TabID Status T1 0 T1 0 Select should give me 1 row only My example is not correct, kindly enhance.
select tabid, GroupDesc = case when groupstatus = '1' or groupstatus = '0' then 'In Progress'
else 'Ok' end
from tab1
where tabid = T1Dabsukol
-
Most of the time there are two/three record in the table. How can you do it in SQL IF Status = 1 or status = 0 THEN Desc = "In Progress" TabID Status T1 1 T1 0 If Status = 1 or status = 1 THEN Desc = "Ok" TabID Status T1 1 T1 1 If status = 0 or status = 0 THEN Desc = "failed" TabID Status T1 0 T1 0 Select should give me 1 row only My example is not correct, kindly enhance.
select tabid, GroupDesc = case when groupstatus = '1' or groupstatus = '0' then 'In Progress'
else 'Ok' end
from tab1
where tabid = T1Dabsukol
Try this:
SELECT tableIdentity,
case when groupstatus = 1 or groupstatus = 0 then 'In Progress' else 'OK' end GroupDesc
from tableOne
where tabid = T1;You should also physically confirm that you have only a single row named T1.