Subject | Re: [firebird-support] How to find duplicate rows when creating a unique index? |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2009-11-24T11:15:59Z |
> I tryselect blz, konto, auszugrn, neugutdatum, count(*) from auszuege
>
> 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?
group by blz, konto, auszugrn, neugutdatum
having count(*)>1
SY, SD.