Mysql中表student_table(id,name,birth,sex),name字段值存在重复,查询name重复的记录明细,比如'张三'、'李四'各重复2次,则结果是4条。如下SQL错误的是()?
select t2.*
from
(select name,count(*) as c1 from student_table GROUP BY name having c1 > 1) t1
left joinstudent_table t2on t1.name = t2.name;
select t2.*
from
(select name,count(*) as c1 from student_table GROUP BY name ) t1
left joinstudent_table t2on t1.name = t2.namewhere c1 > 1;
select t2.* ,t1.*
from
(select name,count(*) as c1 from student_table GROUP BY name ) t1
left joinstudent_table t2on t1.name = t2.nameand c1 > 1;
select t2.*
from
(select * from(select name,count(*) as c1 from student_table GROUP BY name ) t1where c1 > 1)t3left join
student_table t2 on t3.name = t2.name;
select sum(num) from (select name,count(name)-1 as num from student_table group by name having count(name)>1) as t1;