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 |
Table student containing 2 columns,Join date,Employee name. Under join date 4 rows r ter =1-jan-2008,2-feb-2008,3-mar- 2008,4-feb-2008.Under Employee name 4 difeerent names jaison,robin,binoy,rahul Result set is, Table containing 4-column name=jan,feb,mar,april,,beneath these months count is given as 1,2,1,0 means these counts representing number of emplooyees joined in a month(january 1employee,february 2 employee,march 1 employee,april 0 employee) Can you give me the required sql query
Does the unique constraint create an index?
Why is DML provided?
1 Answers Ernst Young, Thomson Reuters,
What action plan is preferred if sql server is not responding?
What are indexes in sql?
What is difference between aggregate and analytic function?
What are the different types of backups avaialabe in sql server 2005?
What are SQL Jobs, please mention the use of it and how to create them.
employee table has employee id ----------- empid ---------------- 1 2 3 3 3 4 5 5 5 6 6 6 7 here the values r repeated two times.how to select the repeated values only.i.e 3,5,6 should alone come.
Issues related in upgrading SQL Server 2000 to 2005 / 2008
How to swap the data of two columns in a table. both the columns containing varchar values.
What are the 3 types of schema?