Answers for "most ordered products in specific country"

0

most ordered products in specific country

SELECT 
  od.ProductID
, p.ProductName
, COUNT(DISTINCT o.OrderID) AS TotalOrders
, COUNT(DISTINCT c.CustomerID) AS TotalCustomers
, SUM(od.Quantity) AS TotalQuantity
FROM "OrderDetails" AS od
INNER JOIN "Orders" AS o ON o.OrderID = od.OrderID
INNER JOIN "Customers" AS c ON c.CustomerID = o.CustomerID
INNER JOIN "Products" AS p ON p.ProductID = od.ProductID
WHERE c.Country = 'Switzerland' 
GROUP BY od.ProductID, p.ProductName
ORDER BY TotalCustomers DESC
Posted by: Guest on April-19-2022

Code answers related to "most ordered products in specific country"

Browse Popular Code Answers by Language