首页 > 解决方案 > SQL批量数据重复检查

问题描述

我有一个应用程序,可以从计费信息表的记录中找到重复项。每个进程包含大约 50K 记录。

表格和结果视图

在此处输入图像描述

In the above picture, highlighted are the result cols and here what I did is , 
Amount Paid Dup == Duplicate count of col 'Amount Paid', 
AmountBilled Dup == Duplicate count of col 'AmountBilled',
Invoice Number WO Alpha Dup == Duplicate count of col value 'Invoice Number' without alpha,
Bill Number Dup == Duplicate count of col 'Bill Number',
Invoice and Bill Number Dup == Combined Duplicate count of col 'Invoice number and Bill Number'.

像上面一样,我需要检查 6 个 cols 的重复项,并且我使用了 merge into 和 with 语句,但是处理文档花费了太多时间。请建议处理类似重复检查的最佳方法。

标签: sqlsql-serversql-server-2008

解决方案


您是否尝试过INTERSECT sql 命令?

在不知道表结构的情况下,我不能给你一个代码示例


推荐阅读