Ok so i am listing entry's in this column and grouping them so its only displaying a category once using:
SELECT category FROM ida_projects GROUP BY category
beside each entry i want to have the number of entries that match that. So if there is 4 entries that are the category "static" then it will print a "4"
i think im close to getting it but i can never seen to get it right so i must be overlooking somthing. Any suggestions.
counting entries in a column
Moderator: General Moderators
-
invisibled
- Forum Contributor
- Posts: 112
- Joined: Sun Apr 29, 2007 3:35 pm
- Location: New Westminster
Code: Select all
SELECT
ip.category,
(select count(*) from ida_projects ip2 where ip.category = ip2.category) as category_count
FROM
ida_projects ip
GROUP BY
ip.category
-
invisibled
- Forum Contributor
- Posts: 112
- Joined: Sun Apr 29, 2007 3:35 pm
- Location: New Westminster