I need some assistance on selecting and counting records from a database.
Every record in the table will have a category example ‘News’ and ‘Sport’. Let say News has 17 category’s and sport has 11. How can I list all category’s and count the total amount of records within that category.
[FONT=verdana]Hmm. Not sure if I understand the question.
You say “Every record in the table will have a category example ‘News’ and ‘Sport’.” But you also say “Let say News has 17 category’s and sport has 11.” If a record has a category named News, how can News have 17 categories?
Do you mean that there might be 17 records for which News is the category?
If so, then to get the number of records in each category, you would do something like this:
SELECT Category, COUNT(*) FROM TheTable GROUP BY Category