I have tables where I have a result of 0-1 0 is gone and 1 is. I need to write a query, and I totally don't know how to. If New_Def = 0 a Default = 1 then 'NEW' If New_Def = 1 a Default = 1 then = OLD.
CodePudding user response:
I think you are looking for case
:
select * , case when New_Def = 0 and Default = 1 then 'NEW'
when New_Def = 1 and Default = 1 then 'OLD'
else 'Unknown'
end as Newcolumn
from table