Count criteria

Z

Zb Kornecki

Hi I have table that has (among others) three date-time fields: Arrive,
Complete, Leave. I would like to create a query field that counts, for each
arrival, how many pt's are completed but waiting to leave. I did this w/ a
sum product line in Excel but haven't been able to port that to Access when
my DB out grew Excel.

Thank- you
Zb
 
D

Dale Fye

Your query might look something like:

SELECT Arrive, Count(*) as WaitingToLeave
FROM yourTable
WHERE [Complete] IS NOT NULL
AND [Leave] IS NULL
GROUP BY Arrive

HTH
Dale
 
Z

Zb Kornecki

Dale since niether time can be null Would the following work?
TY
Zb

SELECT Arrive, Count(*) as WaitingToLeave
FROM yourTable
WHERE [Arrive] IS BETWEEN [Complete] AND [Leave]
GROUP BY WaitingToLeave


Dale Fye said:
Your query might look something like:

SELECT Arrive, Count(*) as WaitingToLeave
FROM yourTable
WHERE [Complete] IS NOT NULL
AND [Leave] IS NULL
GROUP BY Arrive

HTH
Dale

--
Email address is not valid.
Please reply to newsgroup only.


Zb Kornecki said:
Hi I have table that has (among others) three date-time fields: Arrive,
Complete, Leave. I would like to create a query field that counts, for each
arrival, how many pt's are completed but waiting to leave. I did this w/ a
sum product line in Excel but haven't been able to port that to Access when
my DB out grew Excel.

Thank- you
Zb
 
D

Dale Fye

Are you trying to count everyone that is waiting to leave?

If so, I would think the [leave] field would still be null, but you would
not need to include the Arrive in the Select or in the Group By.

It might look like:

SELECT Count(*) as WaitingToLeave
FROM yourTable
WHERE [Complete] IS NOT NULL
AND [Leave] IS NULL

HTH
Dale

Zb Kornecki said:
Dale since niether time can be null Would the following work?
TY
Zb

SELECT Arrive, Count(*) as WaitingToLeave
FROM yourTable
WHERE [Arrive] IS BETWEEN [Complete] AND [Leave]
GROUP BY WaitingToLeave


Dale Fye said:
Your query might look something like:

SELECT Arrive, Count(*) as WaitingToLeave
FROM yourTable
WHERE [Complete] IS NOT NULL
AND [Leave] IS NULL
GROUP BY Arrive

HTH
Dale

--
Email address is not valid.
Please reply to newsgroup only.


Zb Kornecki said:
Hi I have table that has (among others) three date-time fields: Arrive,
Complete, Leave. I would like to create a query field that counts, for
each
arrival, how many pt's are completed but waiting to leave. I did this
w/ a
sum product line in Excel but haven't been able to port that to Access
when
my DB out grew Excel.

Thank- you
Zb
 

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