Count () In the statistics table or in the array record
COUNT (*) returns the number of rows retrieved, regardless of whether the value contains null
COUNT (column_name) returns the count of rows that are NOT NULL for column column_name
For example, query the number of user comments for a recipe for an activity:
SELECT COUNT from WHERE id=530787 and Idtype='paiid'
Now you want to query the number of comments for each user and display them in reverse order of the number of comments:
SELECT COUNT as from WHERE id=530787 and Idtype='paiid' GROUP by ORDER by DESC
Of course, you can also query the number of comments more than 5:
#在group by after using the HAVING clause to qualify the conditions for grouping
SELECT count (Authorid) as C, authorid,author from uchome_ Comment where id530787 and idtype= '
17:20:54 Continuous Update
MySQL in Count (), group by uses