select id, count(*) as nr from ips_voyages group by id having count(*)>1 into cursor tt select tt scan sele ips_voyages locate for id = tt.id if found() delete in ips_voyages endif endscan