日期:2014-05-19  浏览次数:20418 次

帮忙解决下菜鸟的问题牙,路过的千万不要错过牙?
查询一张表中重复的记录???

比如
create   table   a
(
  a   int,
  b   int,
)
里面有数据
1,1
2,3
1,1
2,3
4,5
1,1

------解决方案--------------------

create table tb
(
a int,
b int,
)


insert into tb values(1,1)
insert into tb values(2,3)
insert into tb values(1,1)
insert into tb values(2,3)
insert into tb values(4,5)
insert into tb values(1,1)

select tb.* from tb join
(
select tb.a,count(0) as x
from tb
group by tb.a

)qq on tb.a=qq.a
where qq.x <> 1