标签:
mysql 不支持 分组子查询 over;
SELECT SalesOrderID, ProductID, OrderQty
,SUM(OrderQty) OVER(PARTITION BY SalesOrderID) AS ‘Total‘
,AVG(OrderQty) OVER(PARTITION BY SalesOrderID) AS ‘Avg‘
,COUNT(OrderQty) OVER(PARTITION BY SalesOrderID) AS ‘Count‘
,MIN(OrderQty) OVER(PARTITION BY SalesOrderID) AS ‘Min‘
,MAX(OrderQty) OVER(PARTITION BY SalesOrderID) AS ‘Max‘
FROM SalesOrderDetail
WHERE SalesOrderID IN(43659,43664);
标签:
原文地址:http://www.cnblogs.com/zhangxiaoshuai/p/5511554.html