I have a table named "items" where are stored information about each product sold in each order, but I want to retrieve top 10 orders with max quantity of products sells. I've executed a SELECT statement to retrieve number of products sold in each orders but I don't know How I can retrieve only TOP 10 orders. Thanks.
SELECT codigo_orden AS ORDER_ID, COUNT(codigo_producto) AS PRODUCTS_SOLD
FROM cs_items
GROUP BY codigo_orden
ORDER BY 2 DESC;
But I just want to retrieve TOP 10 most products sold!! Something like that: