count of max in mysql example query

count of max in mysql example query

Count:
Count is an aggregate function which returns the count of rows with respect to our query conditions.

Max:
Max is an aggregate function which returns the max of rows value of a particular column with respect to our query condition. For string which returns the maximum length value instead of occurences.

So you have to use count of max to get the more occurences of the same string in the mysql.

Query:

select searchkey,count(searchkey) as val from search where name='Hems' group by searchkey order by val desc limit 1

512 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *