Why INNER JOIN not equal (!=) hang forever

前端 未结 3 779
伪装坚强ぢ
伪装坚强ぢ 2021-01-01 22:03

When I execute the following query:

SELECT * FROM `table1` 
 INNER JOIN table2 ON table2.number = table1.number

I get the result within 2 s

3条回答
  •  醉梦人生
    2021-01-01 22:50

    Instead of this you can use this method:

    SELECT * FROM `table1` 
         LEFT JOIN table2 ON table2.number = table1.number 
    WHERE 
         table2.number is NULL OR table1.number is NULL
    

提交回复
热议问题