删除重复数据

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;
相关推荐
川石课堂软件测试3 小时前
使用mock进行接口测试教程
数据库·python·功能测试·测试工具·华为·单元测试·appium
Solis程序员3 小时前
MongoDB 超全入门到实战:从原理、CRUD到高可用架构
数据库·mongodb·架构
yurenpai(27届找实习中)3 小时前
redis_点评(26.附近店铺——实现附近商家功能)
数据库·spring boot·redis
BullSmall3 小时前
异构数据库(通俗 + 核心知识点)
数据库
Rick19934 小时前
索引下推(ICP):在已经用到联合索引的前提下,减少回表次数,提升查询效率
数据库
金海境科技4 小时前
实践分享!虚拟化数据恢复前三标准
数据库
不剪发的Tony老师4 小时前
RedisME:一个现代化、轻量级Redis管理工具
数据库·redis
金海境科技4 小时前
实践分享!服务器数据恢复口碑榜
数据库
llilay4 小时前
企业级FastAPI后端模板搭建(三)整合日志Log
数据库·python·fastapi
treacle田4 小时前
使用达梦DTS迁移Oracle数据到达梦数据库过程步骤-记录总结
数据库·dts 迁移oracle到达梦