Achei isso pra você... http://www.firebirdfaq.org/faq301/ no seu caso DELETE FROM TOMADORES T1 WHERE EXISTS ( SELECT 1 FROM TOMADORES T2 WHERE T1.CODIGO = T2.CODIGO AND T1.RDB$DB_KEY < T2.RDB$DB_KEY )