Subject | Re: [firebird-support] How to find duplicate rows when creating a unique index? |
---|---|
Author | PenWin |
Post date | 2009-11-24T11:14:20Z |
> Firebird 2.0.3.12981.0-r6 on Gentoo Linux. I have a table calledSELECT intended_key_field1, intended_key_field2, ..., COUNT(*)
> 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?
>
FROM tablename
GROUP BY intended_key_field1, intended_key_field2, ...
HAVING COUNT(*)>1
Pepak