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
What is field in algebra?
What are the mathematical functions supported by sql server 2005?
What specific conditions database should meet, before you can bulk copy data into it using bcp?
How to download microsoft sql server 2005 express edition?
What objects does the fn_my_permissions function reports on? : sql server security
Why do we need normalization?
How to create function without parameter in sql server?
What are approximate numeric data types in ms sql server?
How to maintain a fill factor in existing indexes?
how to determine the service pack currently installed on sql server? : Sql server database administration
Explain the difference between cross join and full outer join?
What is filter index?
What is coalesce in sql server?
How to choose all records from the table?
Tell me what are the advantages of using stored procedures?