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
Answer Posted / 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 |
Post New Answer View All Answers
on line cluster can we make if yes tell me the procedure
What is a trace frag? Where do we use it?
Explain sub-query?
Explain sql server service broker?
How do you debug a procedure in sql server?
Write a sql query to delete duplicate records from a table called table1
Explain temporary table vs table variable by using cursor alternative?
What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?
What does truncate do?
How many types of keys are there?
Suppose you want to implement the following relationships while designing tables. How would you do it?a.) One-to-oneb.) One-to-manyc.) Many-to-many
What is sql server used for?
What is instead of dml trigger?
What happens if null values are involved in datetime operations?
Why transaction is important?