mysql - SQL statement Max(Count(*)) -


basically have review table product. attributes reviewid, reviewcustname, reviewtext, productid. wonder there ways count product reviews? here sql statement:

select productid, count(*) mostreviews, max(mostreviews) sm_review group productid; 

i wonder possible write such sql statement? or there better way?

thanks in advance.

you can use following result. gets total count each product when order count in descending order , apply limit 1 returns product reviews:

select count(*) total sm_review group productid order total desc limit 1 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -