Sorry for my English at first.
I’m learning SQL in W3schools’s SQL Tryit Editor. You may find there the same tables on which I operate.
How can I sum quantity of the same products?
I tried this:
SELECT Products.ProductName, OrderDetails.Quantity, Customers.Country
FROM Orders
JOIN OrderDetails ON Orders.OrderID = OrderDetails.OrderID
JOIN Products ON OrderDetails.ProductID = Products.ProductID
JOIN Customers ON Orders.CustomerID = Customers.CustomerID WHERE Customers.Country = 'Germany';
and it was my result:
SQL code and result
As you can see for example there is two rows with “Boston Crab Meat” and quantity of this didn’t sum.
New contributor
user24803038 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1