删除重复数据

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;
相关推荐
万添裁6 分钟前
关系模型的数据结构
数据库
「QT(C++)开发工程师」1 小时前
UML | 最好的类图设计工具结合CSDN天启呈现-领路架构师
数据库·uml·类视图
Damon小智1 小时前
玩转ClaudeCode:用Database-MCP实现自然语言操作数据库
数据库·ai编程·claude·vibe coding·claude code
相与还1 小时前
godot+c#使用godot-sqlite连接数据库
数据库·c#·godot
ZHOU_World1 小时前
数据库主从同步
数据库·mysql
茉莉玫瑰花茶1 小时前
MySQL 用户管理
数据库·mysql
FL16238631291 小时前
C#winform流程图工具箱源码支持画矩形箭头圆形菱形保存为图片
数据库·oracle
博一波1 小时前
MySQL 备份与复制:类似“手机数据管理”
数据库·mysql
semantist@语校1 小时前
第二十篇|SAMU教育学院的教育数据剖析:制度阈值、能力矩阵与升学网络
大数据·数据库·人工智能·百度·语言模型·矩阵·prompt
xqlily1 小时前
SQL 数据库简介
数据库·sql