How to find the maximum count using mysql?

Try:

SELECT NAME, COUNT(*) as c FROM table GROUP BY name ORDER BY c DESC LIMIT 1


From the supplied code I understand that you wish to select the highest number of employees that share the same name.

The problem with your query is that you are trying to apply more than one level of aggregation in a single scope.

Try this:

SELECT MAX(Total) FROM (SELECT COUNT(*) AS Total FROM emp1 GROUP BY name) AS Results

...or this:

SELECT COUNT(name) FROM emp1 GROUP BY name ORDER BY COUNT(name) DESC LIMIT 1

Both queries return the same result, but their implementations are different.

Use whichever is the fastest for you or whichever you prefer.