If I got more then one join and in the second join I use left join. by using this clause its going to take all the data from the two first tables or only from the second table.
Thanks
If I got more then one join and in the second join I use left join. by using this clause its going to take all the data from the two first tables or only from the second table.
Thanks
Join is just a method to connect different tables. Theoretically (not computationally), there's no limit on the number of joins you used on a query.
Keep in mind that the order of joins are important once you started to use something other than inner
joins. For example, a LEFT JOIN b
is not equivalent to b LEFT JOIN a
.
With that being said, when you have more than one join, the result should be interpreted carefully.
Consider
SELECT a.id,b.name,c.department
FROM
a INNER JOIN b on a.id = b.id
LEFT JOIN c on a.id = c.id
The resulting table would consist of all id
that is present in both a
and b
, and return NULL
if a department is not present for those id
.
So to answer your question, joins consider all your data in the query. However, the output table depends on the joins you used. If there are still confusion, you can refer to this question which addressed a similar thing.