aprompt1971
Programmer
I'm creating an online shop which has an area showing the top ten best selling products. I'd like to generate the list of the best selling products from my OrdersDetail table (which is table showing listing purchases made on the site), ordered by the most popular at the top and the least popular at the bottom. I thought if I could use the SQL DISTINCT command this would create a list of products without duplicates, then if I could COUNT them I'd generate a list of the most popular products in the OrdersDetails table. This nearly works but the list won't ORDER BY the COUNT column (I get an error). This is my code so far:
SELECT DISTINCT ProductDescription, COUNT(ProductDescription) AS bestSellers
FROM OrdersDetail
GROUP BY ProductDescription
Anyone got any ideas, I know this is more of a SQL query but I'm stuck.
SELECT DISTINCT ProductDescription, COUNT(ProductDescription) AS bestSellers
FROM OrdersDetail
GROUP BY ProductDescription
Anyone got any ideas, I know this is more of a SQL query but I'm stuck.