怎样查询到重复的记录?
create table test
(
ck_bh varchar(20)
)
insert into test select 'ck20060101-1 '
insert into test select 'ck20060101-2 '
insert into test select 'ck20060101-3 '
insert into test select 'ck20060101-4 '
insert into test select 'ck20060101-4 '
insert into test select 'ck20060101-5 '
insert into test select 'ck20060101-10 '
insert into test select 'ck20060101-10 '
/*
怎样写SQL才能查询到重复的记录
要求结果:
ck20060101-4
ck20060101-4
ck20060101-10
ck20060101-10
*/
drop table test
------解决方案--------------------select * from test
where ck_bh in (select ck_bh from test group by ck_bh having count(*)> 1)
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
最新版本:20070130
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html