I'm using the NorthWind database, and I want to select the category that has the largest number of items entered. I was able to list the category ID and the number of products it has with the following command:
SELECT CategoryID, COUNT(ProductID) AS 'Produtos por categoria'
FROM Products
GROUP BY CategoryID
And the return was
CategoryID - Produtos por Categoria
1 12
2 12
3 13
4 10
5 7
6 6
7 5
8 12
I'd like to know how to select the ID that has the most products by category.