-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   [email protected]    deletion
2   [email protected]    addition
3   [email protected]    modification
4   [email protected]    deletion
5   [email protected]    deletion
6   [email protected]    deletion
7   [email protected]    deletion
8   [email protected]    deletion

Should return [email protected] 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