GROUP by usage
650) this.width=650; "Src=" http://images.cnitblog.com/blog/33509/201304/28234015- F1cc175bc15c439d94abf7cb1c52ab97.png "alt=" 28234015-f1cc175bc15c439d94abf7cb1c52ab9 "/>
The fields that you want to filter out with select must be after group by or included in the aggregate function
Cases:
Select category, Summary, sum (quantity) as number of and from agroup by category, summary
The common aggregation functions are
function |
function |
support of |
SUM (column name) |
Sum |
|
Max (column name) |
Maximum Value |
|
Min (column name) |
Minimum value |
|
AVG (column name) |
Average |
|
First (column name) |
First record |
Only access supports |
Last (column name) |
Last record |
Only access supports |
Count (column name) |
Number of statistics records |
Note the difference between the count (*) and |
This article is from the "Overlord Collected Works '" blog, please be sure to keep this source http://zhangtainren.blog.51cto.com/448826/1854629
MYSQL GroupBy use method.