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

html - Cut text on left side inside button while centering -

java - Last square of 8x8 grid not drawn, using two nested FOR loops -

What design pattern is this code in Javascript? -