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

mention different types of relationships in the dbms?

697


What does Master database contains?

787


What are Row versions of DataRow?

784


What are the common performance issues in sql server?

661


Explain security with sql azure?

171






Explain about integration services of Microsoft SQL server?

772


What is a heap?

783


What is trigger explain with program?

708


Do you know what is a linked server in sql server?

710


Define Unique Key?

761


what protocol both networks use? : Sql server database administration

715


What stored by the tempdb ? : sql server database administration

759


Do you know the policy based administration feature of sql server 2008?

732


Does partitioning help performance?

683


What are the basic features of a trigger in ms sql server?

791