How to get maximum repeat count with sql

Hello cou table name

name type kasu 1 kasu 4 kasu 3 nimal 1 nimal 2 

I need this answer as

 name cnt kasu 3 
+4
source share
1 answer
 SELECT name, COUNT(name) AS `cnt` FROM cou GROUP BY name ORDER BY `cnt` DESC LIMIT 1 

OK, so, sorry, I did not find something more elegant, so I did it stupidly. There is definitely another way to do this, though ...

Demo with your example

Another example after adding inputs

+4
source

All Articles