Subject Re: [firebird-support] finding triple entries
Author Alan J Davies
On 10/09/2010 11:10, Christian Waldmann wrote:
> 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?
>
> many thanks
> Christian
Try this:
select a_unique_reference,visitid, count(visitid) as DUPLICATES
from yourtablename
group by a_unique_reference,visitid
having count(visitid)>2

a_unique_reference will be some field you can easily identify, such as
person's name or account id.

--
Alan J Davies
Aldis