-1

I have a table for actions conducted by my users, the 'email' column in that table specifies which user did what. What I want to do is run a query to find the most active user based on the amount of actions containing his email. That is, I want the query to return the email that is most present in my table. I've hit a wall trying to figure out how to do this, any idea?

ID  EMAIL   ACTION
1   tester@gmail.com    deletion
2   tester@gmail.com    addition
3   tester@gmail.com    modification
4   tester@gmail.com    deletion
5   not_a_tester@gmail.com    deletion
6   someone_else@gmail.com    deletion
7   another_guy@gmail.com    deletion
8   not_a_tester@gmail.com    deletion

Should return tester@gmail.com in this instance.

Idan Elhalwani
  • 538
  • 4
  • 12

1 Answers1

0
select count(email) AS maxcount,email 
from table_name 
group by email
having MAX(count(email))
ʰᵈˑ
  • 11,279
  • 3
  • 26
  • 49
Elias
  • 47
  • 7