Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Join 3 tables (table1, table2 & table3) in a single query.

Inner join should be applied for table1 & table 2 and left
outer join for table1 & table3 where table2.dept is ABC

Answers were Sorted based on User's Feedback



Join 3 tables (table1, table2 & table3) in a single query. Inner join should be applied for ..

Answer / dhanasekaran

select *
from table1 t1
inner join table2 t2 on t1.key = t2.key
left outer join table3 t3 on t1.key = t3.key
where t2.dept ='ABC'

Is This Answer Correct ?    11 Yes 0 No

Join 3 tables (table1, table2 & table3) in a single query. Inner join should be applied for ..

Answer / sumit m.

Although the above answer is correct. I am preferring
paranthesis in the answer, something like below:

There are 2 forms of the query for the answer:

SELECT *
FROM (table t1 INNER JOIN table2 t2 ON t1.col = t2.col AND
t2.dept = 'ABC')
LEFT JOIN table t3 ON t1.col = t3.col

OR

SELECT *
FROM (table t1 INNER JOIN (SELECT * FROM table2 WHERE dept
= 'ABC') t2 ON t1.col = t2.col)
LEFT JOIN table t3 ON t1.col = t3.col

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More SQL Server Interview Questions

How can you set the threshold at which sql server will generate keysets asynchronously?

0 Answers  


What are the different types of sub-queries?

0 Answers  


what stored procedure would you use to view lock information? : Sql server administration

0 Answers  


How create table structure only from tableA to TableB if TableA have some data?

4 Answers  


Can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible?

0 Answers  


What is the maximum number of instances in 32 bit and 64 bit sql server 2012?

0 Answers  


Diffrences between sql server 2000 vs 2008

0 Answers   TCS,


how to count datewise data in sqlserver

4 Answers   CarrizalSoft Technologies, IndusInd Bank,


Explain about service Broker functions?

0 Answers  


find 2nd highest salary of person using cursor concept?

6 Answers   HCL,


how to delete duplicate rows in sql server2005

7 Answers   Cisco, CTS, HCL, IBM,


What is the difference between varchar and varchar(max) datatypes?

0 Answers  


Categories