我有两个mysql表

TABLEA

colA1   colA2
1       whatever
2       whatever
3       whatever
4       whatever
5       whatever
6       whatever

第二个表基本上是从tableA派生的,但删除了一些行

tableB的

colB1    colB2
1       whatever
2       whatever
4       whatever
6       whatever

如何编写查询以从上面的两个表中获取缺失行的表

colC1   colC2
3      whatever
5      whatever

最佳答案

SELECT t1.*
FROM TableA t1 LEFT JOIN
     TableB t2 ON t1.ID = t2.ID
WHERE t2.ID IS NULL

dawei

【声明】:丽水站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。