List duplicate names in MySQL for change

0

I need to list all duplicate names in a given table and I'm not getting it, what I have so far is this:

SELECT nome, foto, ativo, count(nome) FROM comColaborador GROUP BY nome HAVING count( nome ) > 1

But this script only shows me a record and its count indicating duplicity, I need to list the same.

I tried it, too:

SELECT nome, foto, ativo FROM comColaborador WHERE nome LIKE "%ABRAAO BRANDAO MORAES%"

But it's too expensive to have to search by entering the names I want.

    
asked by anonymous 22.09.2016 / 23:05

1 answer

0

Try to do with a subquery like this:

SELECT nome, foto, ativo FROM comColaborador 
WHERE id in(
    SELECT id FROM comColaborador GROUP BY nome HAVING count( nome ) > 1
)

I did not have time to test here but I think it's fine

    
22.09.2016 / 23:12