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



I have Two table First have UserName and second is address, in address table more than value relega..

Answer / arun

use Coalesec(addrress1,address2)

Is This Answer Correct ?    6 Yes 1 No

I have Two table First have UserName and second is address, in address table more than value relega..

Answer / krishan

Please solve my problem?

Is This Answer Correct ?    4 Yes 1 No

I have Two table First have UserName and second is address, in address table more than value relega..

Answer / 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

I have Two table First have UserName and second is address, in address table more than value relega..

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

Post New Answer

More SQL Server Interview Questions

Explain system views?

0 Answers  


what is sql injection in sql server?

2 Answers   TATA,


What is difference between foreign key and unique key?

0 Answers  


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

0 Answers   United Healthcare,


What is self contained multi valued query?

0 Answers  






What are the hotfixes and patches in sql server?

0 Answers  


How will you optimize a stored procedure optimization?

0 Answers  


What is lock escalation? : sql server database administration

0 Answers  


What command would you use to create an index?

0 Answers  


Explain the difference between delete,drop and truncate in SQL Server?

0 Answers   HCL,


Where sql server user names and passwords are stored in sql server? : sql server database administration

0 Answers  


A trigger can reference objects outside the current database? State true or false.

0 Answers  


Categories