I'd like to create a new query (that can build a table "05_DataAnalysis_02") that is referencing a table "05_DataAnalysis-01". Within the "05_DataAnalysis-01" table I have a bunch of Events that each have a date/time associated with them (not necessarily unique [meaning multiple events can happen at the exact same second]).
I also have additional columns that calculate Times (adding/removing hours minutes so on and so forth) from the actual event time. As well as a column that vets a few columns of data to determine if it meets a certain criteria:
The query should then put the start time and end time that the criteria is met along with the maximum number of alarms received within that period (I have this stored in a column called [MaxNumEvents])
Flood Event, EarlyEvent, EventTime, LateEvent, numEvents
0, 8/6/19 3:58 PM, 8/6/19 4:58 PM, 8/6/19 5:58 PM, 3
0, 8/10/19 1:29 PM, 8/10/19 2:29 PM, 8/10/19 3:29 PM, 1
0, 8/23/19 11:21 AM, 8/23/19 12:21 PM, 8/23/19 1:21 PM, 3
1, 8/24/19 8:14 AM, 8/24/19 9:14 AM, 8/24/19 10:14 AM, 38
1, 8/24/19 8:14 AM, 8/24/19 9:14 AM, 8/24/19 10:14 AM, 38
1, 8/24/19 8:15 AM,8/24/19 9:15 AM, 8/24/19 10:15 AM, 26
1, 8/24/19 8:16 AM, 8/24/19 9:16 AM, 8/24/19 10:16 AM, 38
0, 8/24/19 8:34 PM, 8/24/19 9:34 PM, 8/24/19 10:34 PM, 1
0, 8/24/19 10:29 PM, 8/24/19 11:29 PM, 8/25/19 12:29 AM, 2
The End Result should look something like this:
StartEvent, EndEvent, MaxNumEvents 8/24/19 8:14 AM, 8/24/19 10:16 AM, 38
And should reproduce for everytime that FloodEvent is = 1
Thank you,
SELECT [Early Event], [Late Event], numEvents FROM [05_DataAnalysis-01] WHERE [Flood Event]=1?