select Name , count(*) from table group by name having count(*) > 1 就是Chekc(checky)说的啦。
不知道你是什么数据库。 Oracle:select [distinct] field from tableA t1 where exists (select field from tableA t2 where t1.field=t2.field and t1.rowid<>t2.rowid )(distinct 可选,视具体需求而定)
ok. 首先,要求效率的话,建立索引。 Create Unique Index IndexName on TableName('某一字段'); 然后,查询,上面也有人说了。 Select Distinct '你要的字段' from TableName;
是某个数据重复还是整个记录数据重复?
from table
group by name
having count(*) > 1 就是Chekc(checky)说的啦。
Oracle:select [distinct] field from tableA t1
where exists
(select field from tableA t2
where t1.field=t2.field
and t1.rowid<>t2.rowid
)(distinct 可选,视具体需求而定)
首先,要求效率的话,建立索引。
Create Unique Index IndexName on TableName('某一字段');
然后,查询,上面也有人说了。
Select Distinct '你要的字段'
from TableName;