0
That consultation:
SELECT C.CompanyName, MAX(SOH.TotalDue) AS Total, A.CountryRegion FROM SalesLT.SalesOrderHeader SOH
INNER JOIN SalesLT.Customer C ON C.CustomerID = SOH.CustomerID
INNER JOIN SalesLT.CustomerAddress CA ON CA.CustomerID = C.CustomerID
INNER JOIN SalesLT.Address A ON A.AddressID = CA.AddressID
GROUP BY A.CountryRegion, C.CompanyName
ORDER BY MAX(SOH.TotalDue) DESC;
But what I need is only one line of the United Kingdom Maximum Total and one line of the United States Maximum Total.
I am unable to do this query select only one from each Countryregion. Someone help me?
The highest value of Total or the sum of Total values? If it is the highest value, the name of the respective company should appear?
– José Diz