left outer join needed?

  • I have a small question, probably a silly one.. When we join 2 tables using left join like below:

    select t1.*

    from table1 as t1

    left outer join table2 as t2

    on t2.id = t1.id

    Here, it will select all the rows of table1. Unless I am selecting any fields from table2, is there any need to do this left join at all? In what cases, left join is useful if we are not selecting anything from table2?

  • Hi gyessql,

    Basically two or more tables should be joined only if the collective information from both the tables or on the basis of the criteria that involves fields from the tables (more than 1) is done.

    If there is no possibility of selecting a single field from table2 then its recommended to not to join tables....

    Thanks,

    Amit

  • Duplicate post. Please post answers here

  • Amit H - Thanks for the clarification.

    Jack - Thanks, I tried to delete the duplicated post but was not able to.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply