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;