Basically over the whole time from the first time stamp until the last time stamp tell me how many High Triggers I get
start by determining the time frame you want to cover. an AGGREGATE query GROUP by trigger with the criteria "High" and Min(timedate) and Max(timedate) will give you this.
in a real world situation you might want to run a preliminary query restricting records to those with today's date, or those with a timestamp on Wednesday afternoon, or whatever. then use that as the record source for the AGGREGATE query.
that will give you something like this:
Code:
SELECT tbl_transaction.trigger, Min(tbl_transaction.timedate) AS timestart, Max(tbl_transaction.timedate) AS timeend
FROM tbl_transaction
GROUP BY tbl_transaction.trigger
HAVING (((tbl_transaction.trigger)="High"));
then you want to count how man high triggers you had in that time frame, so you SELECT records between timestart and timeend, and Count(High) on those records. this last part has to be done in two steps because you can't (or at least I could not) both SELECT the records in that time frame and Count them in one query. so SELECT them first, then count them:
Code:
SELECT tbl_transaction.trigger, tbl_transaction.timedate, tbl_transaction.count
FROM tbl_transaction, qry_periodlength
WHERE (((tbl_transaction.trigger)="High") AND ((tbl_transaction.timedate) Between [qry_periodlength].[timestart] And [qry_periodlength].[timeend]));
save this as qry_recordsrequired, then do this:
Code:
SELECT qry_recordsrequired.trigger, Sum(qry_recordsrequired.count) AS SumOfcount
FROM qry_recordsrequired
GROUP BY qry_recordsrequired.trigger;
good luck with your project,
Cottonshirt