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 |
How do you delete a data source?
What are the types of stored procedures in an sql server?
What is full form of XP ?
42 Answers Cap Gemini, Infosys, Microsoft, Oracle, Reliance,
What is a field in a table?
What are secondary xml indexes?
I am Having tables T1 and T2 both having same data how to check (or) compare the data in both table are same?
how to find maximum identity number in a table ?
2 Answers JPMorgan Chase, Thomson Reuters, Wipro,
What do you mean by 'normalization'?
0 Answers Ernst Young, Thomson Reuters,
What is the default schema of your login session in ms sql server?
What are the benefits of normalization?
How to count groups returned with the group by clause in ms sql server?
What is a join in sql? What are the types of joins?
Oracle (3253)
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)