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 |
What is mapping schema?
What is measure group, measure? : sql server analysis services, ssas
Do you know what is a with(nolock)?
What are the difference between primary keys and foreign keys?
Explain what is log shipping?
Can we take the full database backup in log shipping?
How to get nth highest salary from employee table.
How to delete existing rows in a table?
Please give me the SP for the below scenario. I have two tables named Table1 and Table2...I need to fetch record by record from Table1 and insert the record in to table2 where the value in the sno column of the table1 is even number.
What is surrogate key? : sql server analysis services, ssas
What is the order in which the sql query is executed?
What is check constraint in sql server?
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)