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
What are parameterized reports?
How to create a trigger for insert only?
What is data source document?
What is the template in sql?
What is the server name for sql management studio?
What is the difference between a clustered index and a non-clustered index?
What is the new security features added in sql server 2014? : sql server security
What is report snapshot?
Describe the left outer join & right outer join. : sql server database administration
what purpose does the model database serve? : Sql server database administration
Which are the olap features?
What are dml (data manipulation language) statements in ms sql server?
Explain different types of lock modes in sql server 2000?
Explain rdbms?
How to change a login name in ms sql server?