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 schemabinding a view?
What is the default sql server instance name?
What is the difference between login and a user?
13 Answers CTS, TCS,
what is a correlated sub-query? : Sql server database administration
What is the difference between dropping a database and taking a database offline?
How to return the date part only from a sql server datetime datatype?
What is difference between standardization and normalization?
How to remove duplicate rows from table?
What is data block and how to define data block size?
What is compression - row-level and page-level compression?
What are the disadvantages of using the stored procedures?
I am using SQL Server 2005, I have some select and update statements in my query with WHERE clause I want to prevent these queries from SQL injection attacks. What are the steps and precautions to be taken for SQL Injection attacks? Does anybody have suggestions? Thanks in advance,
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)