I think your conditionYou can be rewritten as the sum ofgroup by system_one_idleast and system_two_idgreatest should be uniqueto select the minimum id of each group and delete rows with other id's.
delete from mytable where id not in ( select * from ( select min(id) from mytable group by greatest(system_one_id, +system_two_id), least(system_one_id, system_two_id) ) t1 )