删除重复数据

sql 复制代码
delete iot_instruction
from 
iot_instruction,
(
	SELECT
   min(id) id,
	 GROUP_CONCAT(id) as ids,
   command,
	 instruction_type,
	 protocol_id
  FROM
   iot_instruction
  GROUP BY
   command,instruction_type,protocol_id
  HAVING
   count(*) > 1
) t2
where iot_instruction.command = t2.command and iot_instruction.protocol_id = t2.protocol_id
and iot_instruction.instruction_type= t2.instruction_type and iot_instruction.id>t2.id;
相关推荐
这个DBA有点耶15 小时前
ELT 工具选型完整指南:从 ETL 差异分析到工程落地
数据库·架构·代码规范
IvorySQL15 小时前
PostgreSQL 日报|堆表选择性索引更新(10 月 13 日)
数据库·人工智能·postgresql·开源·区块链
张洛闻Eren15 小时前
Ansible【第一课】:Ansible介绍
运维·数据库·云原生·kubernetes·github·ansible
深圳市益普科技有限公司16 小时前
中小封装厂上 MES,为什么十个项目九个坑?
大数据·数据库·人工智能
云边云科技_云网融合16 小时前
从 POS 机到访客 Wi-Fi:零售门店安全建设的完整解法
服务器·网络·数据库
天行健,君子而铎16 小时前
知形-数据库风险监测系统:非侵入式、可溯源、差异化的数据库安全方案
网络·数据库·安全
这个DBA有点耶16 小时前
分布式事务深度:TCC空回滚、悬挂与Saga补偿风暴的根因与解法
数据库·mysql·代码规范
执笔为剑16 小时前
2.1.2-2、V8R3迁移到V8R6-迁移介绍
数据库
hiahiahia12317 小时前
Message 和对话
服务器·前端·数据库
又尔D.17 小时前
MySQL下载安装
数据库·mysql