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

Do you know what are different types of replication in sql server?

1037


What does normalization do to data?

993


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?

936


What is a result set object returned by mssql_query()?

1078


What is the difference between varchar and nvarchar datatypes?

1037


what is a schema in sql server 2005? : Sql server database administration

959


What command do we use to rename a db, a table and a column?

876


Name three of the features managed by the surface area configuration tool? : sql server security

945


How many database files are there in sql server 2000?what are they?

980


What are the steps you should follow to start sql server in single-user mode?

847


How to add a new dsn with the odbc driver for sql server?

1011


What is the size of transaction log file?

871


what is a correlated sub-query? : Sql server database administration

895


Difference between Sql server reporting services and Crystal reports?

158


What are the steps you must follow to hide sql server instances?

931