Count by rating and district

S

shaggles

I need to create a report or query that will show a count
of each rating by by district. How can I count the number
of branch offices rated excellent, fair, poor in each
district? If I didn't need to break it down by district I
think I could just do CountofExcellent, CountofFair,
CountofPoor and stick them all in a query with no joins
but how do I show the correct count for each district?
 
G

Gerald Stanley

Please include the relavant table layouts as we cannot see
your database.

Gerald Stanley MCSD
 
S

shaggles

There is a District table witht he fields DistrictID,
District, DistrictManager which is joined to a Branch
table on the field DistrictID. The Branch table also
contains a CurrentRating field which is what I'm trying to
count. CurrentRating is a numeric field and the rating
can be 1, 2, or 3. I'm trying to get a count of how many
1's per district, 2's per district and 3's per district.
 
G

Gerald Stanley

Try something along the lines of

SELECT districtId, currentRating, Count(1)
FROM Branch
GROUP BY districtId, currentRating

Hope This Helps
Gerald Stanley MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top