Subject Re: [firebird-support] How to find duplicate rows when creating a unique index?
Author Dimitry Sibiryakov
> I try
>
> CREATE UNIQUE INDEX AUSINDEX
> on AUSZUEGE (BLZ, KONTO, AUSZUGNR, NEUGUTDATUM);
>
> (with BLZ=CHAR(8), KONTO=VARCHAR(10), AUSZUGNR=INTEGER, and
> NEUGUTDATUM=DATE)
>
> and get
> "attempt to store duplicate value (visible to active transactions)
> in unique index "AUSINDEX"."
>
> So I need to identify those duplicate values by something like
> SELECT * from AUSZUEGE where COUNT(two_consecutive_identical_rows)>1;
> but how can I say "two_consecutive_identical_rows" in SQL?

select blz, konto, auszugrn, neugutdatum, count(*) from auszuege
group by blz, konto, auszugrn, neugutdatum
having count(*)>1

SY, SD.