MySQL Forums
Forum List  »  Newbie

extract the first 10 catalogs have sold the most...
Posted by: Giorgio Canepa
Date: December 22, 2021 07:48AM

Hi All,
hoping to find All You Well.
I would like to extract the first 10 catalogs have sold the most from my db.
I just try this :

SELECT DISTINCT catalog, (SELECT SUM(X) FROM table) AS TOT FROM table ORDER BY TOT ASC LIMIT 0,10

but I get the first 10 catalogs with the same TOT for each one and I would like to have the TOT of each catalog.

thanks
Gio

Options: ReplyQuote


Subject
Written By
Posted
extract the first 10 catalogs have sold the most...
December 22, 2021 07:48AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.