Click here to Skip to main content
15,892,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is the base table structure

ID RegNo NewID NewRegNo
1 a001 - -
2 a002 - -
3 a003 1 a004
4 a005 - -
5 a006 2 a007
6 a008 3 a008

Now i want to get this

ID RegNo
1 a001
2 a002
3 a004
4 a005
5 a007
6 a008
Posted
Updated 23-Sep-12 20:16pm
v2
Comments
Abhijit Parab 24-Sep-12 2:19am    
what you want to show all RegNo or all NewIds in a single column?
sahabiswarup 24-Sep-12 2:21am    
i want to bind RegNo and NewRegNo..and display that with ID

1 solution

Hi,

you can use case when syntax for that.
Try the following query for that.

SQL
select id,
regno = case when NewRegNo is null then RegNo else NewRegNo end
from Table_1


Thanks,
Viprat
 
Share this answer
 
Comments
sahabiswarup 24-Sep-12 2:25am    
Thanks viprat..for your help
VIPR@T 24-Sep-12 2:29am    
you wellcome..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900