Cases take time

JordanR

Registered User.
Local time
Today, 09:08
Joined
Jan 25, 2005
Messages
72
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.
 
You can use your calculation in an IIF:
IIF(Calculation<3,"Light",IIF(Calculation>=6,"Heavy","Medium"))
 
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, but it is better to create three queries and then UNION them together into one query.
 
JordanR said:
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.
 

Users who are viewing this thread

Back
Top Bottom