Why MySQL's LEFT JOIN is returning “NULL” records when with WHERE clause?

前端 未结 4 634
野性不改
野性不改 2021-02-01 09:39

Today I\'ve tried some more complex MySQL queries and I\'ve noticed that MySQL\'s LEFT JOIN is not working with WHERE clause. I mean, it does return some records but it does not

4条回答
  •  感情败类
    2021-02-01 10:15

    A left join condition and where condition filter are not both same. Data is filtered by the where clause after the physical join is done. if you look a left join it will normally return every row from your left table, but once you have a where clause, it will filter the output of the join so the result is like an inner join. You will want to focus on the two diagrams on the left side of the image below.

    enter image description here

提交回复
热议问题