Subject Re: [firebird-support] How to find duplicate rows when creating a unique index?
Author PenWin
> Firebird 2.0.3.12981.0-r6 on Gentoo Linux. I have a table called
> AUSZUEGE and would like to create a unique index on some of the
> columns of that table. But it wouldn't let me - there are still
> some duplicate rows in that table (which I try to avoid in the
> future by creating that unique index). How can I find that dupli-
> cate rows?
>
> 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 intended_key_field1, intended_key_field2, ..., COUNT(*)
FROM tablename
GROUP BY intended_key_field1, intended_key_field2, ...
HAVING COUNT(*)>1

Pepak