How to LEFT JOIN in SQL Without Duplicates

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 3

  • @Don_Data
    @Don_Data  Месяц назад +1

    Hi friend,
    did you ever encounter this problem? How do you solve it?

  • @skateforlife3679
    @skateforlife3679 4 дня назад

    Got this problems a lot. I think we need to understand how joins work.
    If the right or left table column joining key is not unique. We will have duplicate. Am I right ?

    • @Don_Data
      @Don_Data  4 дня назад

      Hi @skateforlife3679,
      that is exactly the case, correct!
      The thing with join is, that we sometimes want the duplicate rows and sometimes not. But this behavior is not intuitive and we have to explicitly think about what is going on at the data level when our join criteria might not be unique.
      When we don't want the duplicates, we have to explicitly work our way around it (e.g. using DISTINCT, GROUP BY or String Aggregations).
      But, you explained it much shorter than me 😀...
      Have a nice day,
      Henning aka Don Data