I got three tables that I'm trying to join together. My goal is to see of each order, its orderdate, orderid, customer and the total amount of delivered items. Each unique item in a order get a separate line in the order details table which means that I need to sum the total amount in my join but I don't know how?
SELECT Orders.OrderDate
, Orders.OrderID
, Customers.CustomerName
, OrderDetails.Quantity AS "Deliverd products"
FROM Orders INNER JOIN Customers ON Customers.CustomerID = Orders.CustomerID
INNER JOIN Orderdetails ON Orders.OrderID = OrderDetails.OrderID
ORDER BY CustomerName;