Return record with highest number of appearances

Asked

Viewed 139 times

3

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

See the following image:

I would like to get "Joao". I tried to use mysql_num_rows, but I was unsuccessful.

There’s a way to mysql_num_rows?

2 answers

4


The query should be the following:

SELECT nome FROM tbl_abc GROUP BY nome ORDER BY count(nome) Desc LIMIT 1
  • The query worked perfectly! Thank you!

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

Upshot

inserir a descrição da imagem aqui

  • Just like in the previous answer, it worked perfectly. Thank you!

  • Oops! Need, just give a shout here @VME Hugs and good luck!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.