-4
I need to double-check the register with the same CNPJ to eliminate duplicates. select needs to bring the code information,duplicate clients name.
Bank structure:
tabela CADCLI ( codigo, nome,cnpj )
BD used: Firebird
I tried that select:
SELECT CODIGO,
RAZAO,
CNPJ
FROM CADCLI WHERE CNPJ IN (
SELECT CNPJ
FROM CADCLI
GROUP BY CNPJ
HAVING COUNT(*) > 1)
ORDER BY CNPJ
But it hangs not and does not bring the result.
It would be nice if you provide the structure of the tables and what you’ve tried so far so we can help you
– Sorack
Use Cunt() to count CNPJS, group by and dps using having Count() > 0
– Pedro Filipe
cadcli table, CNPJ field.
– Wesley Godoi
Related: How to delete all duplicates except one?
– Sorack
I recommend editing the question and putting the type of bank not to confuse who will answer.
– Leonardo Bonetti