查找表中的重复行 [英] Finding duplicates rows in a table
本文介绍了查找表中的重复行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在表中连接2个colimns并在其中找到重复项。
我已经使用过该方法
select * from tableA a
where(从TableA中选择count(*)b
其中acol1 + + col2 = b.col1 + + col2)> 1
但性能非常糟糕。
数据也很庞大
你能帮助我吗
提前致谢
I have to concatenate 2 colimns in a table and find duplicates in them.
I already used the method
select * from tableA a
where (select count(*) from TableA b
where acol1+ +col2 = b.col1+ +col2)>1
But the performance is very bad.
Data is also huge
Can you help me
Thanks in advance
推荐答案
我必须在表格中连接2个colimns并在其中找到重复项。
我已经使用过该方法
select *来自tableA a
其中(从TableA中选择计数(*)b
其中acol1 + + col2 = b.col1 + + col2)> 1
但表现非常糟糕。
数据也很庞大
你能帮帮我
先谢谢
I have to concatenate 2 colimns in a table and find duplicates in them.
I already used the method
select * from tableA a
where (select count(*) from TableA b
where acol1+ +col2 = b.col1+ +col2)>1
But the performance is very bad.
Data is also huge
Can you help me
Thanks in advance
尝试这个以显示重复项。
try this to show the duplicates.
展开 | 选择 | 换行 | 行号
您好ck9663,
感谢您的立即回复。
但是当我运行以下查询时
选择Col1 + + Col2
来自TableA
group by Col1 + + Col2
有(count(*))> 1
我应该得到重复项。
但是我从你建议的查询得到的副本是
与上面的qurey不同。
以上查询错了吗?
请你帮帮我
提前致谢
Hi ck9663,
Thank u for u r immediate reply.
But when I run the below query
select Col1 + + Col2
from TableA
group by Col1 + + Col2
having(count(*))>1
I should get the duplicates .
But the the duplicate which I got from the query which u suggested is
different from the above qurey.
Is the above query wrong?
can u please help me
Thanks in advance
尝试:
try:
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号
这篇关于查找表中的重复行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文