删除重复的记录,并保存第一条记录或保存最后一条记录
时间:2021-09-05 09:44:59|栏目:MsSql|点击: 次
删除表:dgpage中Mail重复的记录并保留最后一条.
delete dgpage where id in ( select a.id from dgpage a, dgpage b where a.mail = b.mail and a.id > b.id )
删除表:dgpage中Mail重复的记录并保留最近一条.
delete dgpage where id in ( select a.id from dgpage a, dgpage b where a.mail = b.mail and a.id <b.id )
delete dgpage where id in ( select a.id from dgpage a, dgpage b where a.mail = b.mail and a.id > b.id )
删除表:dgpage中Mail重复的记录并保留最近一条.
delete dgpage where id in ( select a.id from dgpage a, dgpage b where a.mail = b.mail and a.id <b.id )
栏 目:MsSql
下一篇:SQL Server Table中XML列的操作代码
本文标题:删除重复的记录,并保存第一条记录或保存最后一条记录
本文地址:http://www.codeinn.net/misctech/172671.html