删除重复数据

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;
相关推荐
NineData9 小时前
杭州 OpenClaw 开发者聚会来了!NineData 叶正盛将带来主题分享
数据库·人工智能
wang24559819910 小时前
【MySQL基础篇】概述及SQL指令:DDL及DML
sql·mysql·oracle
2401_8980751211 小时前
Python在金融科技(FinTech)中的应用
jvm·数据库·python
IvorySQL11 小时前
PostgreSQL 技术日报 (3月14日)|AI 落地 PostgreSQL 拒绝 PPT 空谈
数据库·postgresql·开源
JavaGuide11 小时前
鹅厂面试:SELECT * 一定导致索引失效?常见索引失效场景有哪些?
java·数据库·后端·mysql·大厂面试
wmfglpz8812 小时前
NumPy入门:高性能科学计算的基础
jvm·数据库·python
泯仲12 小时前
从零起步学习MySQL 第十二章:MySQL分页性能如何优化?
数据库·学习·mysql
IvorySQL12 小时前
直播预告|PostgreSQL 18.3 x IvorySQL 5.3:开启 AI 数据库新纪元
数据库·postgresql·开源
TDengine (老段)13 小时前
TDengine IDMP 组态面板 —— 创建组态
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
SelectDB13 小时前
Apache Doris + SelectDB:定义 AI 时代,实时分析的三大范式
大数据·数据库·数据分析