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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -