Hi @greenfield70 ,
Thank you so much for posting here.
Please refer below and check whether it is helpful to you.
--combine
select ProductID, LocationID
, sum(Quantity) OVER (PARTITION BY LocationID) SubtotalsLocationID
, sum(Quantity) OVER (PARTITION BY ProductID) SubtotalsProductID
from Production.ProductInventory
order by ProductID, LocationID
--split
select ProductID, LocationID
, sum(Quantity) OVER (PARTITION BY LocationID) SubtotalsLocationID
from Production.ProductInventory
order by ProductID, LocationID
select LocationID,ProductID
, sum(Quantity) OVER (PARTITION BY ProductID) SubtotalsProductID
from Production.ProductInventory
order by LocationID,ProductID
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues October--Users always get connection timeout problem when using multi subnet AG via listener. Especially after failover to another subnet