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 create hyperlink from returned sql query ?
What is primary key index?
What is difference between group by and having?
What stored by the tempdb ? : sql server database administration
How to get the definition of a trigger back?
How to receive returning result from a query?
How do I edit a procedure in sql server?
What is difference statement and preparedstatement?
How connect excel to sql server?
What is delete query?
What is a document index?
What is logon trigger?
what are different types of backups available in sql server? : Sql server database administration
Where is localdb stored?
What is sql service broker?