I want the top 5 products from a table
If i use this
SELECT MAX(ProductCode) AS ProductName
FROM OrderDetails
I get only one result I want the top 5 result
I want the top 5 products from a table
If i use this
SELECT MAX(ProductCode) AS ProductName
FROM OrderDetails
I get only one result I want the top 5 result
Try this for MySQl
SELECT ProductCode FROM OrderDetails
ORDER BY ProductCode Desc
LIMIT 5
solved..by using this query
SELECT TOP 5 ProductName, COUNT(ProductName) AS value_occurrence FROM OrderDetails GROUP BY ProductName ORDER BY value_occurrence DESC