Hi all,
I am having a table and there is a column named id. I have to choose the id and in case if id is null i have set id to '1' otherwise the same id should be displayed. For this i tried the following query but the result is not the proper one which i expect pls help me in this regard
[code=sql]
select substring(numbe r,2), case when substring(numbe r,2) is null then '1' else substring(numbe r,2) end as id from emp
[/code]
[code=text]
substring id
224 224
[/code]
I am having a table and there is a column named id. I have to choose the id and in case if id is null i have set id to '1' otherwise the same id should be displayed. For this i tried the following query but the result is not the proper one which i expect pls help me in this regard
[code=sql]
select substring(numbe r,2), case when substring(numbe r,2) is null then '1' else substring(numbe r,2) end as id from emp
[/code]
[code=text]
substring id
224 224
[/code]
Comment