select a.* from tb_s a join (select 姓名,课程,count(*) from tb_s group by 姓名,课程 having count(*)>1) b on a.课程=b.课程 and a.姓名=b.姓名

解决方案 »

  1.   

    select a.* from tb_s a where (select count(*) from tb_s where 姓名=a.姓名 and 课程=a.课程)>1
      

  2.   

    select a.* from tb_s a where exists 
    (select 1 from tb_s b where a.姓名=b.姓名 and a.课程=b.课程 and a.编号<>b.编号)
      

  3.   

    select * from tb_s where 姓名+课程 in(select 姓名+课程 from tb_s group by(姓名+课程) having count(姓名+课程)>1)