且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查找表中的重复行

更新时间:2023-02-26 15:11:20


我必须在表格中连接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:

展开 | 选择 | Wrap | 行号