Last post Nov 14, 2014 04:46 AM by sandeepmittal11
Nov 12, 2014 12:41 AM|rajanireddy|LINK
Suppose, there is a requirement where we need to use left join and inner join in a query.
Which join to be used first for the query to perform well.
Nov 12, 2014 12:48 AM|sreejukg|LINK
Which query to use will be based on your requirements.. but left join will be more efficient that inner join
Nov 12, 2014 04:35 AM|rajanireddy|LINK
My requirment here is, I must use both the joins, I want to know the sequence, which one to be used first to improve the performance?
Left join...inner join (or) inner join....left join
Nov 13, 2014 04:37 AM|Michelle Ge - MSFT|LINK
So far as I know, inner join will display all the records which are all effective. Lest join will display those records which contains null reocrds in left table. If you only want to improve the performance, I suggest you first using inner join.
There is a thread about the difference between inner join, left join and right join, please refer to the link below:
Hope it's useful for you.
Nov 14, 2014 04:31 AM|wmec|LINK
The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match.
SQL LEFT JOIN Syntax
LEFT JOIN table2
LEFT OUTER JOIN table2
The INNER JOIN keyword selects all rows from both tables as long as there is a match between the columns in both tables.
SQL INNER JOIN Syntax
INNER JOIN table2
Nov 14, 2014 04:46 AM|sandeepmittal11|LINK
First use inner join and then left join. It is because left join will fetch all records the from left hand side table which may later be filtered out in the next inner join, so better first use inner join so that records get filtered out in the first join