首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

MySQL删除重复数据行,只保存一条

2014-04-27 
MySQL删除重复数据行,只保留一条delete from devices_allwhere device_id in (selectdevice_id from(selec

MySQL删除重复数据行,只保留一条
delete from devices_allwhere device_id in (select device_id from (select device_id from devices_all a group by a.device_id having count(a.device_id) > 1) as a) and device_all_id not in (select device_all_id from (select min( device_all_id) device_all_id from devices_all group by device_id having count( device_id)>1) as b)

?

热点排行