Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

I have Two table First have UserName and second is address,
in address table more than value relegated to UserName
table, i want to fetch 2nd address if exist other wise 1st
address access

Answer Posted / manoj pandey

select user_name, coalesce(address1, address2) as address
from username u
left join address a
on u.userid = a.userid


For more Interview Questions check my blog: http://sqlwithmanoj.wordpress.com/interview-questions/

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the downside of using udf?

1160


What is Dependency Injection and provide example?

1178


What are difference between Cluster index and Non-Cluster index?

1130


How to return the date part only from a sql server datetime datatype?

1164


You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?

158


Write a program using SQL queries to find a unique entry in a table.

1043


How to find the source of a table in sql server?

1037


Do you know spatial data types - geometry and geography in sql server 2008?

1089


Is INSTEAD OF trigger directly applicable to Table ?

1066


What are the advantages of using a stored procedure?

1058


While you are inserting values into a table with the insert into .. Values option, does the order of the columns in the insert statement have to be the same as the order of the columns in the table?

1037


What is the difference between index seek vs. Index scan?

1063


What is sql stored procedure?

1145


What are the High-Availability solutions in SQL Server and differentiate them briefly?

1187


Can a table be created inside a trigger?

1012