Student
_______________________
SudentId Name
101 Peter
103 John
112 James
116 Peter
117 Peter
SudentId_Subject
_______________________
SudentId Subject
101 Physics
103 Chemistry
112 Mathematics
116 Physics
117 Commerce
To find duplicate students, I tried the query
select * from Student group by Name having count(*)>1, got
SudentId Name
_______________________
101 Peter
116 Peter
117 Peter
Actually, I need to filter out students with the same subject. those.
101 Peter
116 Peter
are duplicates (the same subject), but not 117 Peter
How can I write a query for this?
source
share