LEFT JOIN

  • Hello, it looks like simple issue, but not for me :(:

    Table1:

    SELECT *

    FROM Table1

    ______________

    87000 rows

    SELECT *

    FROM Table1

    LEFT JOIN Table2 on Table1.ID = Table2.ID

    ______________

    99000 rows

    It should be the same numbers?

    What am I missing?

  • You have duplicate ID in the table 2, therefore, the left join is showing you every match from table1, that has been found, or not, in table 2. If there are duplicates on your join, they will be present.

    Cheers,

    J-F

  • Thanks J-F,

    That is my misunderstanding of LEFT JOIN.

    And I found better explanation of LEFT JOIN. I didn't count that "situation", when I can have duplicate in Table2.

    In my case, it should be highly unlikely, since it is product name in Table2. It looks like couple of thousand products with more than one name.

    Regards,

    Brano

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

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