create TEMPORARY TABLE DUPLICATED_NODES select MAX(ID_INTERNAL) AS ID FROM NODE GROUP BY KEY_PARENT, KEY_CHILD HAVING COUNT(*) > 1;

 delete FROM NODE WHERE NODE.ID_INTERNAL IN (SELECT DUPLICATED_NODES.ID FROM DUPLICATED_NODES);
