By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

complex SQL count

Tarantulus
100+
P: 114
Hi Guys,

I posted this question before but made a real hash of the explanation, so here goes the second try:

I have a database, with error messages in groups, which are linked to another table with categories. for example-

tbl.groups has 2 entries for "technical difficulties", each assigned a category ID (one for sign in, one for registration)

so, to clarify tbl.groups looks something like this

Category ID
Group ID
Error
and tbl.category looks like this

category ID
Category
now comes the complex bit-

these two tables are fed into another table which looks like this

entry ID
category ID
Group ID
what I want to do, is create a report where I use COUNT on entry ID for each individual Category ID and Group ID.

is this possible without doing individual "COUNT entry ID WHERE group ID = X" queries?

I hope this makes sense
May 29 '07 #1
Share this Question
Share on Google+
3 Replies

Rabbit
Expert Mod 10K+
P: 12,441
Hi Guys,

I posted this question before but made a real hash of the explanation, so here goes the second try:

I have a database, with error messages in groups, which are linked to another table with categories. for example-

tbl.groups has 2 entries for "technical difficulties", each assigned a category ID (one for sign in, one for registration)

so, to clarify tbl.groups looks something like this

Category ID
Group ID
Error
and tbl.category looks like this

category ID
Category
now comes the complex bit-

these two tables are fed into another table which looks like this

entry ID
category ID
Group ID
what I want to do, is create a report where I use COUNT on entry ID for each individual Category ID and Group ID.

is this possible without doing individual "COUNT entry ID WHERE group ID = X" queries?

I hope this makes sense
Why not just group by Category ID and Group ID?
May 29 '07 #2

Tarantulus
100+
P: 114
I'm not sure I get what you mean, I need to know how many entries there are for each group within each category.
May 30 '07 #3

Rabbit
Expert Mod 10K+
P: 12,441
I'm not sure I get what you mean, I need to know how many entries there are for each group within each category.
Yes, if you do a count and group by both categories then that is what you'll get. Click, View > Totals and it'll let you set grouping and summary options.
May 30 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.