删除重复数据

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;
相关推荐
洛神灬殇几秒前
【LLM大模型技术专题】「入门到精通系列教程」基于ai-openai-spring-boot-starter集成开发实战指南
网络·数据库·微服务·云原生·架构
小鸡脚来咯11 分钟前
redis分片集群架构
数据库·redis·架构
christine-rr1 小时前
征文投稿:如何写一份实用的技术文档?——以软件配置为例
运维·前端·网络·数据库·软件构建
海尔辛1 小时前
SQL 基础入门
数据库·sql
betazhou2 小时前
有没有 MariaDB 5.5.56 对应 MySQL CONNECTION_CONTROL 插件
linux·数据库·mysql·oracle·mariadb
Elohim8153 小时前
数据库SQLite基础
数据库·sqlite
TDengine (老段)3 小时前
TDengine 支持的平台汇总
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
大熊猫侯佩3 小时前
由一个 SwiftData “诡异”运行时崩溃而引发的钩深索隐(四)
数据库·swiftui·apple watch
想用offer打牌4 小时前
面试官问:Redis和MySQL数据一致,为什么还需要MySQL?🤠
数据库·redis·mysql
chen.@-@4 小时前
后端下载限速(redis记录实时并发,bucket4j动态限速)
数据库·redis·缓存