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
Post a Comment