Return record with the highest number of appearances

3

Well, I would like to know how to return the record with the field with the highest number of occurrences in a phpMyAdmin database table.

See the following image:

Iwouldliketoget" Joao ". I tried using mysql_num_rows , but I was not successful.

What can I do for mysql_num_rows ?

    
asked by anonymous 27.08.2016 / 20:02

2 answers

4

The query should be as follows:

SELECT nome FROM tbl_abc GROUP BY nome ORDER BY count(nome) Desc LIMIT 1
    
27.08.2016 / 20:43
2

You can show this way using the following query:

SELECT id, nome, count(nome) quantidade FROM tblPessoas 
GROUP BY nome 
ORDER BY count(nome) desc limit 1

Result

    
27.08.2016 / 21:16