Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » SQL Anywhere 服务器 - SQL 的用法 » 查询和修改数据 » 对查询结果进行汇总、分组和排序 » GROUP BY 子句:将查询结果划分为组


具有多个列的 GROUP BY

可以在 GROUP BY 子句中列出多个表达式—也就是说,可以通过表达式的任意组合对表进行分组。


SELECT Name, Size, AVG( UnitPrice )
   FROM Products
   GROUP BY Name, Size;
Name Size AVG(Products.UnitPrice)
Baseball Cap One size fits all 9.5
Sweatshirt Large 24
Tee Shirt Large 14
Tee Shirt One size fits all 14
... ... ...