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 the downside of using udf?
What is Dependency Injection and provide example?
What are difference between Cluster index and Non-Cluster index?
How to return the date part only from a sql server datetime datatype?
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?
Write a program using SQL queries to find a unique entry in a table.
How to find the source of a table in sql server?
Do you know spatial data types - geometry and geography in sql server 2008?
Is INSTEAD OF trigger directly applicable to Table ?
What are the advantages of using a stored procedure?
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?
What is the difference between index seek vs. Index scan?
What is sql stored procedure?
What are the High-Availability solutions in SQL Server and differentiate them briefly?
Can a table be created inside a trigger?