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
Define self join?
What is sql injection and why is it a problem? : sql server security
How do we upgrade from SQL Server 6.5 to 7.0 and 7.0 to 2000?
you notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it? : Sql server administration
What the class forname () does?
What is clr ddl trigger?
Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?
How do you send email on SQL Server?
How to turn off warning messages during php execution?
Tell about MOM Tool(Microsoft Operator Manager)?
1.what are diff types of joins , and explain diff between cross join and full outer join 2.diff types of views 3. Diff types of index 4. What is diff b/w stores procedure and function procedure 5.diff between double and int in SQL 6.diff between char and varchar in SQL. 7.Oracle or SQL whice you will preferred and why.
Give me any three differences between Truncate and Delete.
what is a mixed extent? : Sql server administration
Describe how to use linked server?
Explain sql server authentication modes?