Total order value z bazy northwind

0

Cześć, muszę dodać w SELECT'ie nową kolumne - total orders value - czyli wartość wszystkich zamówień o tym Id'ku.
Jeden order zawiera informacje o jednym produkcie i ilościach.
Mianowicie próbowałem coś kombinować z inner joinami, z nestowanymi selectami, ale już nie ogarniam:
screenshot-20221103113443.png

SELECT o.OrderID, o.OrderDate, c.CompanyName, c.ContactName, p.ProductName, od.UnitPrice, od.Quantity, od.UnitPrice * od.Quantity AS [Order Details Value]
FROM Orders o 
INNER JOIN Customers c ON o.CustomerID = c.CustomerID INNER JOIN [Order Details] od ON o.OrderID = od.OrderID 
INNER JOIN Products p ON p.ProductID = od.ProductID 
//testing part INNER JOIN (SELECT od2.Quantity * od2.UnitPrice FROM [Order Details] od2 GROUP BY od2.OrderID) od3 ON od.OrderID = od2.OrderID end testing part//

Tabela z zadania ma wyglądać następująco i moje pytanie brzmi, jak dodać tą ostatnią, bo nie umiem sobie poradzić :(
screenshot-20221103113537.png

2

Zobacz tak

SELECT o.OrderID, o.OrderDate, c.CompanyName, c.ContactName, p.ProductName, od.UnitPrice, od.Quantity, od.UnitPrice * od.Quantity AS [Order Details Value]
FROM Orders o 
INNER JOIN Customers c ON o.CustomerID = c.CustomerID INNER JOIN [Order Details] od ON o.OrderID = od.OrderID 
INNER JOIN Products p ON p.ProductID = od.ProductID 
INNER JOIN (SELECT sum(od2.Quantity * od2.UnitPrice),od2.OrderID FROM [Order Details] od2 GROUP BY od2.OrderID) od3 ON od.OrderID = od2.OrderID end testing part

1 użytkowników online, w tym zalogowanych: 0, gości: 1