To Get the Count Of Items By Groupwise

2011-09-08

Some times we may need to get the count of items by grouping the items. For example we may need to get the Fruits, No Of Fruits In Quantity


SELECT FruitName,
COUNT(*) AS FruitQty
FROM FruitsTable
GROUP BY FruitName
HAVING COUNT(FruitName) > 10
ORDER BY 2 DESC



This will list the fruits which are more than 10 in quantity

0 comments: