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

posted on 2012-07-19 15:18  成天狂  阅读(556)  评论(0编辑  收藏  举报