MYSQL Left Join how do I select NULL values?

后端 未结 4 1946
执念已碎
执念已碎 2020-12-09 14:43

This is a follow up question to my last question about table joins in MySQL

I need to be able to select the NULL values from the left joined table.

Here\'s m

4条回答
  •  青春惊慌失措
    2020-12-09 15:30

    To compare NULL values you have to use the IS NULL predicate, like this:

    SELECT table1.*, table2.*
    FROM table1
    LEFT JOIN table2 ON table1.id=table2.id
    WHERE table2.surname IS NULL
    

提交回复
热议问题