Hello, All
My database should help to track usage of some kind of tanks. There TWO events that can happen to a tank and that we want to track - event "0" (cleaning) and event "1" (using).
The aim is to count how many times was every tank used after it was cleaned.
All events are entered into EventLog table:
[Tank #] [date] [event type]
--------------------------------
501 01/01/2002 0
501 02/01/2002 1
501 03/01/2002 1
501 04/01/2002 0 <-last cleaning
501 05/01/2002 1 <-using after cleaning
501 06/01/2002 1 <-using after cleaning
(for tank 501, event "1" happened 2 times after the last event "0"
702 01/02/2002 0
702 02/02/2002 1
702 03/02/2002 1
702 04/02/2002 0 <-last cleaning
702 05/02/2002 1 <-using after cleaning
(for tank 501, event "1" happened once after the last event "0"
Can I build a query resulting in such dataset:
[tank #] [last cleaning date] [used .. times]
-----------------------------------------------
501 04/01/2002 2
702 04/02/2002 1
Any idea appreciated.
My database should help to track usage of some kind of tanks. There TWO events that can happen to a tank and that we want to track - event "0" (cleaning) and event "1" (using).
The aim is to count how many times was every tank used after it was cleaned.
All events are entered into EventLog table:
[Tank #] [date] [event type]
--------------------------------
501 01/01/2002 0
501 02/01/2002 1
501 03/01/2002 1
501 04/01/2002 0 <-last cleaning
501 05/01/2002 1 <-using after cleaning
501 06/01/2002 1 <-using after cleaning
(for tank 501, event "1" happened 2 times after the last event "0"
702 01/02/2002 0
702 02/02/2002 1
702 03/02/2002 1
702 04/02/2002 0 <-last cleaning
702 05/02/2002 1 <-using after cleaning
(for tank 501, event "1" happened once after the last event "0"
Can I build a query resulting in such dataset:
[tank #] [last cleaning date] [used .. times]
-----------------------------------------------
501 04/01/2002 2
702 04/02/2002 1
Any idea appreciated.