Subject Re: [firebird-support] finding triple entries
Author PenWin
Dne 10.9.2010 12:10, Christian Waldmann napsal(a):
> Hello SQL experts
>
> I have a table with a colum visitId ( and some other culoms)
>
> Each visitiId is exactly twice in the tabel. By error there are some
> visitId more than twice in the table.
>
> Who knows an efficent query to find all rows where the visitid is
> present more than two times?

SELECT visitId, COUNT(*)
FROM sometable
GROUP BY visitId
HAVING COUNT(*)>=3

This lists the offending visitIds. Finding rows which contain these
visitIds should be easy enough to do given a list of these IDs.

Pepak