删除重复数据

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有点耶8 小时前
云数据库半夜卡顿,CPU才30%?深挖云盘IOPS突发限制与内核挂起机制
数据库·mysql·云原生
无言听风雨丶9 小时前
Redis 运维实战与排错
运维·数据库·redis
小天源11 小时前
智叟云集系统 · 架构与职责分层
服务器·前端·数据库
herinspace11 小时前
管家婆实用贴-SQL 2008如何修改成混合模式
服务器·数据库·sql·管家婆软件·财务软件·合肥管家婆软件
打螺丝的小李11 小时前
制造企业质量管理系统的三类产品形态:分别解决什么问题
数据库·制造
xixingzhe212 小时前
MySQL 锁表故障排查与处理
数据库·mysql
真上帝的左手12 小时前
30. 技术专题-‌应用框架组件-关系型数据库-MySQL-Mybatis
数据库·分布式·mysql·中间件·mybatis
为思念酝酿的痛12 小时前
MySQL表的连接
数据库·mysql
数字新视界13 小时前
机房动环监控系统在提升数据中心能效与安全中的应用探索
大数据·服务器·数据库·动环监控系统·动力与环境监控系统
bksczm13 小时前
MySQL之存储引擎
数据库·mysql