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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is SQL Azure Data sync?

103


What is etl - extraction, transformation, and loading?

520


What is log in sql server?

586


Explain how many normalization forms?

575


What is stored procedures?

542






What are the types of database schema? : sql server analysis services, ssas

598


What does normalization do to data?

538


What are difference between Cluster index and Non-Cluster index?

606


Call by value and call by reference in procedure and function, with NOCOPY.

833


Is a null value equal to anything? Can a space in a column be considered a null value? Why or why not?

630


what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?

1571


what is the information that can be stored inside a bit column? : Sql server database administration

516


Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?

491


what are different types of backups available in sql server? : Sql server database administration

494


How to make a remote connection in a database?

532