首页 > 代码库 > 去重的sql
去重的sql
DELETE FROM `obd_comprehensive_d_1`
USING `obd_comprehensive_d_1`,(
SELECT DISTINCT MIN(`id`) AS `id` , box_id,data_time
FROM `obd_comprehensive_d_1`
GROUP BY `box_id`,`data_time`
HAVING COUNT(1) > 1
) AS `t2`
WHERE `obd_comprehensive_d_1`.`box_id` = `t2`.`box_id`
AND `obd_comprehensive_d_1`.`data_time` = `t2`.`data_time`
AND `obd_comprehensive_d_1`.`id` <> `t2`.`id`;
USING `obd_comprehensive_d_1`,(
SELECT DISTINCT MIN(`id`) AS `id` , box_id,data_time
FROM `obd_comprehensive_d_1`
GROUP BY `box_id`,`data_time`
HAVING COUNT(1) > 1
) AS `t2`
WHERE `obd_comprehensive_d_1`.`box_id` = `t2`.`box_id`
AND `obd_comprehensive_d_1`.`data_time` = `t2`.`data_time`
AND `obd_comprehensive_d_1`.`id` <> `t2`.`id`;
去重的sql
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。