*Northwind Trader (SQL)* Using the OrderDetails table, list the ProductID, the total number of orders that product was included in, and the max discount amount on any order of that product. Provide appropriate column names for the number of orders and max discount amount. Only include products where the max discount amount for that product was greater than $1,000.
1
Expert's answer
2020-10-15T09:50:57-0400
SELECT MAX(ValueOfOrders) ValueOfOrders
FROM
(
select
sum(unitprice * quantity * 1+Discount) as ValueOfOrders
from
OrderDetails od
join
orders o on od.OrderID = o.OrderID
group by
CustomerID
) T
Comments
Leave a comment