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 |
Can we add an identity column to decimal datatype?
How do I view a script in sql server?
What is user-defined multi-statement table-valued function?
what is the information that can be stored inside a bit column? : Sql server database administration
What are the differences between substr and charindex in sql server.
What are cursors? Name four types of cursors and when each one would be applied?
Which joins are sql server default?
What is the difference between Userdefined function and stored procedure? Explain and give the example also
How can windows applications connect to sql servers via odbc?
How do you send email on SQL Server?
What is the most common type of join?
Where are magic tables stored ? Is it in the same database where it is created ?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)