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
How to use linked server?
What are the 2 types of classifications of constraints in the sql server?
Explain Capacity planning to create a database? and how to monitor it?
Why olap is used?
Can we add an identity column to decimal datatype?
How can i Relate Tables in SSIS
What are the different types of Indexes available in SQL Server?
Explain what you mean by 3 tier architecture.
What is the maximum row of a size?
What is sql injection and why is it a problem? : sql server security
What stored procedure can you use to display the current processes?
How do I connect to sql server database?
What number sorts of privileges are accessible in sql?
What is sql server schema compare? How we can compare two database schemas?
How many non clustered indexes there can be on table ?