如何在sqlserver中找到丢失的记录 [英] How to find missing record's in sqlserver

查看:103
本文介绍了如何在sqlserver中找到丢失的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表...让我说tableA和tableB当我将数据从tableA转储到tableB时,某些记录丢失了......

如何查看缺失记录...

任何人都可以通过SQL查询帮助我...



我尝试过:



我试过像左连接这样的JOINS但我没有得到它

I have two tables...let's say tableA and tableB when I dumped the data from tableA to tableB some record's are missing...
How to see the missings record's...
Can anyone help me with this by a SQL query...

What I have tried:

I tried JOINS like left join but I didn't get it

推荐答案

查找表A中的记录表B中没有:

To find the records in table A which are not in table B:
SELECT
    ... Columns ...
FROM
    TableA

EXCEPT

SELECT
    ... Columns ...
FROM
    TableB



您需要从两个表中选择相同的列。

EXCEPT和INTERSECT(Transact-SQL)| Microsoft Docs [ ^ ]


这篇关于如何在sqlserver中找到丢失的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆