oDisplay the ProductID for the product that has been sold the most (i.e., that has been sold in the highest quantity).
I am trying to run the SQL query on Terada (shown below) and keep getting the same error "cannot nest aggregate operations."
Someone please help.
SELECT productid
FROM soldvia
GROUP BY productid
HAVING SUM(noofitems) = (SELECT MAX(SUM(noofitems))
FROM soldvia
GROUP BY productid);
If you have any doubts, please give me comment...
SELECT productid
FROM soldvia
GROUP BY productid
HAVING SUM(noofitems) >=ALL(
SELECT SUM(noofitems)
FROM soldvia
GROUP BY productid);
Get Answers For Free
Most questions answered within 1 hours.