Use the GROUP BY clause in a SELECT statement to group rows together that have the same value in one or more column, or the same computed value using expressions with any functions and operators except grouping functions. When you use a GROUP BY clause, you will get a single result row for each group of rows that have the same value for the expression given in GROUP BY.
mysql>selectcount(*), channel from wlan_client where channel >15; +----------+---------+ |count(*) | channel | +----------+---------+ |165594|44| +----------+---------+ 1rowinset (0.30 sec)
group by 整数
You can also use a single integer as the grouping expression. If you use an integer n, the results will be grouped by the nth column in the select expression.
这里是另一种用法,N代表select中的第N项,如上面的select count(), channel from wlan_client group by channel就可写成select count(), channel from wlan_client group by 2