How to return rows from left table not found in right table?

前端 未结 7 992
滥情空心
滥情空心 2020-12-23 09:09

I have two tables with similar column names and I need to return records from the left table which are not found in the right table? I have a primary key(column) which will

7条回答
  •  清歌不尽
    2020-12-23 09:45

    I also like to use NOT EXISTS. When it comes to performance if index correctly it should perform the same as a LEFT JOIN or better. Plus its easier to read.

    SELECT Column1
    FROM TableA a
    WHERE NOT EXISTS ( SELECT Column1
                       FROM Tableb b
                       WHERE a.Column1 = b.Column1
                     )
    

提交回复
热议问题