SELECT st_id FROM ( SELECT *,ROW_NUMBER() OVER( PARTITION BY st_code ORDER BY st_code ) AS num FROM dbo.t_student_info) a WHERE a.num>=2
给重复的信息排序,如果信息重复num的值为2,然后查出num=2的数据st_id,然后删除
SELECT st_id FROM ( SELECT *,ROW_NUMBER() OVER( PARTITION BY st_code ORDER BY st_code ) AS num FROM dbo.t_student_info) a WHERE a.num>=2
给重复的信息排序,如果信息重复num的值为2,然后查出num=2的数据st_id,然后删除