--查询重复的数据
select * from stu where Code in(select Code from stu group by Code,Namehaving Count(ID) > 1)and Name in (select Name from stu group by Code,Namehaving Count(ID) > 1)--用重复的字段分组,不重复的字段Count--第二种 只能查询出Code这一个字段重复的数据select * from stu where Code= ( select Code from stu group by Code having Count(Code)>1 )