GROUP BY 语句用于根据一个或多个列对结果集进行分组。

语法

SELECT [ DISTINCT ]
{ * | projectItem [, projectItem ]* }
FROM tableExpression
[ GROUP BY { groupItem [, groupItem ]* } ];

示例

SELECT Customer, SUM(OrderPrice) FROM xxx
GROUP BY Customer;