select id ,Count(*) from table_name group by id having count(*)>1
查询数学成绩相同的记录,并显示出该成绩相同记录数
SELECT Math,COUNT(*) from [TestDB].[dbo].[Student] group by Math having COUNT(*)>1;