select * from tb group by name,class having count(name)>1 and count(class)>1
select t1.* from [表名] t1, (select name,class from [表名] group by name,class having count(*)>1) t2 where t1.name=t2.name and t1.class=t2.class
--参考思想:select * from tb where a2 in (select a2 from tb group by a2 having(count(*)>1))
select * from table where id in (select min(id) from table group by name, class)
select * from tb where name+','+Convert(nvarchar(10),class)=(select name+','+Convert(nvarchar(10),class) from tb group by name,class having count(*)>1)
select * from tb group by name,class having count(name)>1 and count(class)>1这个方法不错
select * from tb group by name,class having count(name)>1 and count(class)>1
(select name,class from [表名] group by name,class having count(*)>1) t2
where t1.name=t2.name and t1.class=t2.class
select * from tb where name+','+Convert(nvarchar(10),class)=(select name+','+Convert(nvarchar(10),class) from tb group by name,class having count(*)>1)
这种写法再2000和2005里都会报错(因为还有id字段没在group中),2008我没验证过,有验证过的回复下。