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
Answers were Sorted based on User's Feedback
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 |
Answer / sayali
Select u.name,coalesce(a.address2, a.address1)as Address
from Username u left join address a
on u.userid = a.userid
Is This Answer Correct ? | 0 Yes | 0 No |
Explain system views?
what is sql injection in sql server?
What is difference between foreign key and unique key?
how can you select rexcord(rows) from table A which is not present in Table B . Id being the FK in Table B referencing to ID Table A
What is self contained multi valued query?
What are the hotfixes and patches in sql server?
How will you optimize a stored procedure optimization?
What is lock escalation? : sql server database administration
What command would you use to create an index?
Explain the difference between delete,drop and truncate in SQL Server?
Where sql server user names and passwords are stored in sql server? : sql server database administration
A trigger can reference objects outside the current database? State true or false.