473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

doubt in CASE command

priyan
54
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
Expand|Select|Wrap|Line Numbers
  1. select substring(number,2), case when substring(number,2) is null then '1' else substring(number,2) end as id  from emp
  2.  
Expand|Select|Wrap|Line Numbers
  1.                                                  substring  id
  2.  
  3.  
  4.  
  5.  
  6.  224       224
  7.  
Nov 16 '07 #1
1 2430
rski
700 Expert 512MB
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
Expand|Select|Wrap|Line Numbers
  1. select substring(number,2), case when substring(number,2) is null then '1' else substring(number,2) end as id  from emp
  2.  
Expand|Select|Wrap|Line Numbers
  1.                                                  substring  id
  2.  
  3.  
  4.  
  5.  
  6.  224       224
  7.  
What does your table look like. Show data.
Nov 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mahesh | last post by:
Hi all, I have a doubt with OOAD and Dialogs. I have a Dialog Class. tkSimple.py It contains a class body as below. Now I am calling the tkSimple.py in another python program and using the...
46
by: James Harris | last post by:
Before I embark on a new long-term project I'd appreciate your advice on how to split up long names. I would like to keep the standards for command names the same as that for variable names....
12
by: Phoe6 | last post by:
The Program Fragment is this: int choice; /* Users Input Command */ .. .. .. printf("Enter a command: "); fflush(stdin); choice = getc(stdin); printf("\n");
6
by: Baskar RajaSekharan | last post by:
In C-sharp, I wnat to know whether the Component is compiled in Debug Mode or Run Mode through Code. How is it possible? Is there any way to Access the Config file and check? Please let me know...
1
by: maridu h.s.n.v.prasad | last post by:
subscribe end hai sir i am using the postgresql 7.2 my doubt is what is the command of to see the list of databases i create a database named "jntuoes" database created it's displayed but i...
11
by: Bob Nelson | last post by:
I don't remember seeing the term ``doubt'' used much in c.l.c. back in the 90's. When did this word become nearly synonymous with ``question'' or ``query'' and does it have static duration?
2
by: Pierre Rouleau | last post by:
Hi all, I have a consistent test case where os.popen3() hangs in Windows. The system hangs when retrieving the lines from the child process stdout. I know there were several reports related to...
1
by: manoj | last post by:
he exact question is i have to open first cmd and run this command openvpn --management-query-passwords --cd "C:\Program Files\OpenVPN \config" --management-hold --management 127.0.0.1 7536...
2
by: rockyd2 | last post by:
Here is the code } if(command.equalsIgnoreCase("home")) { if(teleblock == true){ sendMessage("A magical force stops you from teleporting."); //made by Musicmad441 } else {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.