View Full Version : Cases take time


JordanR
09-13-2005, 08:52 AM
Same database as all my other questions, but this time the request is that each case has a duration field.
Is there an easy way to have a single query give a count of how many cases were considered light, medium or heavy given that light is a duration of 0-2 hours, medium is 3-5 hours and heavy is 6+.
The only thing I could think of was to have a query for light, medium and heavy to do the counts for me. But I was curious if there's a way to have one query do it.

FoFa
09-13-2005, 09:13 AM
You can use your calculation in an IIF:
IIF(Calculation<3,"Light",IIF(Calculation>=6,"Heavy","Medium"))

JordanR
09-13-2005, 09:49 AM
But I want to get a query that returns:

Light Cases 5
Medium Cases 7
Heavy Cases 2

Or whatever.

I'm not trying to find out IF a case is high, medium or low. I'm trying to get a count of cases that fit each criteria, and wondering if that can be done in a single query.

FoFa
09-13-2005, 11:01 AM
Yes, but it is better to create three queries and then UNION them together into one query.

ScottGem
09-13-2005, 12:49 PM
But I want to get a query that returns:

Light Cases 5
Medium Cases 7
Heavy Cases 2

Or whatever.

I'm not trying to find out IF a case is high, medium or low. I'm trying to get a count of cases that fit each criteria, and wondering if that can be done in a single query.

Yes, you need to use a column like Fofa suggested as a Group By, then count the PK field.