mtownsend123 — 2012-08-06T05:19:04-04:00 — #1
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.
so. . .
mikl — 2012-08-06T06:32:57-04:00 — #2
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
Does that answer you question?
webber123456 — 2012-08-06T12:44:27-04:00 — #3
Not really an ASP problem. You may want to post this to an SQL forum They do this type of problem all day long.
spacephoenix — 2012-08-06T14:21:03-04:00 — #4
Thread moved to the databases forum
r937 — 2012-08-06T16:50:35-04:00 — #5
all day, and all of the night
bonus points if you can name that song
guelphdad — 2012-08-06T18:44:47-04:00 — #6
The song was in my head, but couldn't think of who it way by. I'm not posting since I had to look it up.