group by:对数据进行分组,实现分类汇总
获取产品类别的单价合计
select CategoryName,ProductName,UnitPrice from northwind.categories right join northwind.products on northwind.categories.CategoryIDhahah =
northwind.products.CategoryID
注意事项:
sql语句中包含了group by。那么,查询的字段要么作为分组的依据;要么是使用了聚合函数,不然会报错哦