Já q é Firebird 2.0 tem algo +/- assim.

SELECT CLIENTE.NOME
  FROM CLIENTE
 WHERE CLIENTE.DT_NASCIMENTO IN ( SELECT T.DT_NASCIMENTO
                                    FROM ( SELECT CLIENTE.DT_NASCIMENTO, 
COUNT( CLIENTE.ID_CLIENTE )
                                             FROM CLIENTE
                                            GROUP BY CLIENTE.DT_NASCIMENTO
                                           HAVING 
COUNT(CLIENTE.ID_CLIENTE) > 1
                                            ORDER BY 
COUNT(CLIENTE.ID_CLIENTE) ) T )


Em 03/04/2008 10:58, Odail Della Niesi Junior escreveu:
>
> Pessoal,
>
> Tenho uma tabela de clientes em uma banco firebird 2.0, e podem existir
> clientes repetidos nesta tabela. Através do select abaixo trago as
> possívies ocorrências que provavelmente estão repetidos.
>
> select cliente.dt_nascimento, count(cliente.id_cliente)
> from cliente
> group by cliente.dt_nascimento
> having count(cliente.id_cliente) > 1
> order by count(cliente.id_cliente)
>
> Necessito de um outro select para listar os nomes e fazer uma
> conferência e excluir os repedidos de fato, algo do tipo:
>
> select cliente.nome from cliente
> where cliente.dt_nascimento in (select cliente.dt_nascimento,
> count(cliente.id_cliente)
> from cliente
> group by cliente.dt_nascimento
> having count(cliente.id_cliente) > 1
> order by count(cliente.id_cliente))
>
> Mais é exibida a seguinte mensagem de erro:
>
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Invalid command.
> count of column list and variable list do not match.
>
> Agradeço antecipadamente a ajuda dos colegas.
> Um forte abraço,
>
> Odail
>
>  

-- 

Responder a