I have this
Select DISTINCT p.productname, c.companyname,od.productID,
(SELECT
sum( quantity )
FROM orderdetails where productID=p.ProductID) as total
from
customers c inner join orders o on
c.customerid=o.customerid inner join orderdetails od on
o.orderid=od.orderid inner join products p on
od.productid=p.productid
order by c.companyname, total DESC
and that returns me
I need it to only return the row of the highest total for each companyname