dcount events between to limits

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

will dcount work
2 tables
First has Aircraft with Start and Stop values and unique event ID
AircraftID StratHours End Hours Event
546 50 65 xxx
546 50 51 zz
Second is list of every Aircraft and Each hour flown;
Aircraft Hr
555 1
555 2
546 50
546 51
546 52

I need the count for each aircraft / hour ie.;546 at hour 50 & 51 had 2
events each and at hour 52 had 1 event
 
The SQL for that query would look something like the following.

SELECT [AirHours].[AirCraft]
, Count([AirHours].
) as EventCount
FROM [AirHours] INNER JOIN [Events]
ON [AirHours].[AirCraft] = [Events].[AircraftID]
AND ([AirHours].
>=[Events].[StartHours] and
[AirHours].
<=[Events].[EndHours])
GROUP BY [AirHours].[AirCraft]

The above cannot be built in the query grid because it is using a comparison
in the join that uses something besides equals.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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

Similar Threads

Scheduled Backup Always Fails - Error 546 0
Complex sum 4
SQL Help 2
Time formula help needed 2
Multiple conditions for selecting an entire row 2
Counting event times 5
Updates Fail 2
A trip to the space coast 11

Back
Top