一个SQL完成恐怕不好写吧,可以建个临时表tmpname,里面只有一个name字段,然后:
insert into tmpname(name) select name from nowtable group by name having count(*)>1;
然后:select nowtable.* from nowtable,tmpname where nowtable.name=tmpname.name;
即得结果,nowtable是你要查的表。

解决方案 »

  1.   

    如果支持子查询的话,那一个SQL就很简单了。
      

  2.   

    select * from nowtable where name=(select name from nowtable);
      

  3.   

    select * from table group by name having count(*)>1
      

  4.   

    select * from table where name in (select name from table group by name having count(*)>1);听我的没错
      

  5.   

    select name,count(name) as name_count from table group by name having name_count>1;