表结构如下:
student area yearlevel code year sem result
123010 INFO 9 0002 2015 1 77
123011 INFO 9 0002 2015 1 70
123012 INFO 9 0002 2015 1 55
123037 INFO 9 0002 2016 2 49
123037 INFO 9 0002 2017 1 NULL
123010 COMP 9 0007 2016 1 82
123010 ISYS 9 0026 2015 2 82
123011 ISYS 9 0026 2015 2 88
123012 ISYS 9 0026 2015 2 66
123010 COMP 9 0038 2016 2 77
123010 COMP 9 0041 2016 1 45
123010 COMP 9 0041 2017 1 NULL
123010 ISYS 9 0049 2016 1 88
因此,学生101有一个重复的主题000002
答案 0 :(得分:0)
使用GROUP BY和HAVING功能:
SELECT student,subject
FROM your_table
GROUP BY student,subject
HAVING COUNT (*) > 1
答案 1 :(得分:0)
这应该有效:
select Student,subject from table group by student, subject having count(*)>1