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 - Unusual behaviour when drawing lots of images onto a large canvas -

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

javascript - Chart.js - setting tooltip z-index -