SELECT DISTINCT SalesOrderID,
SUM(LineTotal)
OVER(PARTITION BY SalesOrderID)
AS [Total]
FROM Sales.SalesOrderDetail
ORDER BY SalesOrderID
SELECT SalesOrderID,
SUM(LineTotal) AS [Total]
FROM Sales.SalesOrderDetail
GROUP BY SalesOrderID
ORDER BY SalesOrderID
a
b
c
d
