CREATE TABLE xhftest
(
id int NOT NULL ,
name varchar(50) NULL,
sex char(1) NULL,
age int NULL
)
insert into xhftest (id,name,sex,age) values(1,'xhf',1,20)
insert into xhftest (id,name,sex,age) values(2,'xhf',1,30)
insert into xhftest (id,name,sex,age) values(3,'xhf1',1,30)
insert into xhftest (id,name,sex,age) values(4,'xhf1',1,30)
insert into xhftest (id,name,sex,age) values(5,'xhf2',1,30)
insert into xhftest (id,name,sex,age) values(6,'xhf2',1,30)
insert into xhftest (id,name,sex,age) values(7,'xhf2',1,30)
insert into xhftest (id,name,sex,age) values(8,'xhf3',1,30)
insert into xhftest (id,name,sex,age) values(9,'xhf3',1,30)
insert into xhftest (id,name,sex,age) values(10,'xhf3',1,30)
insert into xhftest (id,name,sex,age) values(11,'xhf4',1,30)
insert into xhftest (id,name,sex,age) values(12,'xhf5',1,25)
select * from xhftest
select name,sex,age from xhftest group by name,sex,age having count(*)>=2
select a.* from xhftest a,(select name,sex,age from xhftest group by name,sex,age having count(*)>=2) b
where a.name=b.name and a.sex=b.sex and a.age=b.age
drop table xhftest