How do I find the most popular products

DanielD

New member
Local time
Today, 10:47
Joined
Nov 30, 2017
Messages
6
How would I go about finding the most popular and must unpopular product in this database?

Thank you
:)
 

Attachments

Have you sold any?

Sent from my SM-G925F using Tapatalk
 
Its for a college assignment, this is the database we were given.
I've tried to do query for the quantity of products sold but its not grouping them by name (there is sometime multiple orders from different customers)
 
As it's an assignment - you won't learn if you don't try, show show us what you have tried.
 
Have you sold any?
:)

Most popular: Camembert Pierrot - 1577 ordered
Least popular: Mishi Kobe Niku - 95 ordered

Query used:

Code:
SELECT Products.ProductID, Products.ProductName, Sum([Order Details].Quantity) AS TotalOrdered
FROM Products INNER JOIN [Order Details] ON Products.ProductID = [Order Details].ProductID
GROUP BY Products.ProductID, Products.ProductName
ORDER BY Sum([Order Details].Quantity) DESC;

EDIT:
Whilst I was answering this, you added it was a college assignment.
If I'd known I would have given a hint & not the answer.
Too late now
In future, PLEASE state that in your first post
 
All I could see was them all individually, not how to group them together.
We were never taught this in lesson
 
So that was your homework ...to find out!
Nah it wasn't to find that bit out, it was to say what tables would be used to find it. I could've done that bit myself, I'd have add up all of the large groups together. to see what was most common
 
Nah it wasn't to find that bit out, it was to say what tables would be used to find it. I could've done that bit myself, I'd have add up all of the large groups together. to see what was most common

If you could have done it yourself, why didn't you?
 
Nobody in class could do it, we're told to ask eachother so....
 

Users who are viewing this thread

Back
Top Bottom