Set Theory or RunSum Expression---Help Needed

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

Guest

I have a database that collects the number of hours during a flight. These
hours are associated when the flight took place. I have made a query that
will give me results base on what happen during the last 90 days of the dat
entered. This works and no problem. I would like now to take this
information the query has presented and do the following:

I have two fields Flight Date and Hours. I would like to write a expression
that will add the hours, from the most recent entry, and add these hours
until 20 hours have been accumlated. When 20 hours have been acheived this
would give me the date of the entry that the 20 hours were met.

I hope I have made some sense of this. Any help you can give me would be
greatly appreciated. Thank you.

Lee
 
Lee said:
I have a database that collects the number of hours during a flight. These
hours are associated when the flight took place. I have made a query that
will give me results base on what happen during the last 90 days of the dat
entered. This works and no problem. I would like now to take this
information the query has presented and do the following:

I have two fields Flight Date and Hours. I would like to write a expression
that will add the hours, from the most recent entry, and add these hours
until 20 hours have been accumlated. When 20 hours have been acheived this
would give me the date of the entry that the 20 hours were met.

I hope I have made some sense of this. Any help you can give me would be
greatly appreciated. Thank you.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I see you're trying for an answer again. Perhaps this:

SELECT FlightDate
FROM table_name As A
GROUP BY FlightDate
HAVING ((SELECT Sum([Hours]) FROM table_name
WHERE FlightDate <= A.FlightDate)
MOD 20) = 0

This will give the flight date for every date where the sum of hours =
20.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnk63oechKqOuFEgEQIydwCdFOW/YQilFXv4zjSXibnbGzajvtEAn2u2
t2PazE2m/8zc8jxfSVGusdqd
=ipF1
-----END PGP SIGNATURE-----
 

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

Back
Top