Count by rating and district

  • Thread starter Thread starter shaggles
  • Start date Start date
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?
 
Please include the relavant table layouts as we cannot see
your database.

Gerald Stanley MCSD
 
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.
 
Try something along the lines of

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

Hope This Helps
Gerald Stanley MCSD
 
Back
Top