I've seen examples where the query orders by count and takes the top row, but in this case there can be multiple "most frequent" values, so I might want to return more than just a single result.

In this case I want to find the most frequently appearing last names in a users table, here's what I have so far:

select last_name from users group by last_name having max(count(*));

Unfortunately with this query I get an error that my max function is nested too deeply.

Edit
Report