删除重复数据

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;
相关推荐
ZWZhangYu3 小时前
LangChain 构建向量数据库和检索器
数据库·langchain·easyui
feifeigo1234 小时前
升级到MySQL 8.4,MySQL启动报错:io_setup() failed with EAGAIN
数据库·mysql·adb
火龙谷5 小时前
【nosql】有哪些非关系型数据库?
数据库·nosql
焱焱枫6 小时前
Oracle获取执行计划之10046 技术详解
数据库·oracle
双力臂4047 小时前
MyBatis动态SQL进阶:复杂查询与性能优化实战
java·sql·性能优化·mybatis
qq_392397127 小时前
Redis常用操作
数据库·redis·wpf
A__tao9 小时前
一键将 SQL 转为 Java 实体类,全面支持 MySQL / PostgreSQL / Oracle!
java·sql·mysql
一只fish9 小时前
MySQL 8.0 OCP 1Z0-908 题目解析(17)
数据库·mysql
花好月圆春祺夏安10 小时前
基于odoo17的设计模式详解---装饰模式
数据库·python·设计模式
A__tao10 小时前
SQL 转 Java 实体类工具
java·数据库·sql