1

I am having trouble getting the the count of the top 10 products bought. I am using MySQL 8.

I was given a table that includes the following column:

Product
-
Speakers, E book reader
Shoes, Sunglasses
Sports Magazine, Car Magazine
NULL
NULL
T-shirts
NULL
NULL
Shoes, Socks
None

What's the easiest way I can count the items?

hibe1927
  • 11
  • 1

1 Answers1

0

Try this:

SELECT COUNT(product) AS product_count FROM table1 GROUP BY product ORDER BY product _count DESC LIMIT 10;
Dharman
  • 30,962
  • 25
  • 85
  • 135
T.Maharani
  • 108
  • 5