sql server如何利用开窗函数over()进行分组统计
2017-02-05
19
这是一道常见的面试题,在实际项目中经常会用到。需求:求出以产品类别为分组,各个分组里价格最高的产品信息。实现过程如下:declare @t table(ProductID int,ProductName varchar(20),ProductType varchar(20),Price int)--测试数据insert @tselect 1,"name1","P1",3 union allselect 2,"name2","P1",5 union alls...