当前位置: 代码迷 >> SQL >> 剔除重复记录的高效SQL
  详细解决方案

剔除重复记录的高效SQL

热度:28   发布时间:2016-05-05 11:05:16.0
删除重复记录的高效SQL
删除重复记录的高效SQL:

delete from student pdi where pdi.rowid in
(select t1.rowid FROM student t1,
   (select t.s_no, max(t.id) max_id from student t group by t.s_no having count(*) > 1) t2
where t1.s_no = t2.s_no and t1.id != t2.max_id)