Im having this rather complex query problem I'd like resolved.
1 table, 4 Columns,
tblErrors:
TramId(3) ErrorCode(1) Date (yyyy-mm-dd) Time(hh:mm:ss)
200 A 2005-01-01 12:15:01
200 A 2005-01-01 12:17:02
201 A 2005-01-01 13:00:15
201 B 2005-01-01 12:17:30
....
The key is all 4 columns together.
Basically the same error can occur only once at the same time (second) on a particular tram.
Say now I want the record count of everytime ErrorCode 'A' happens in a time interval of 3 minutes before ErrorCode 'B' occurs.
In my example the count would be 2. record 1 and 2 happen within that time interval of 3 minutes.
The reason I need this query, is to find a link between 2 errorcodes.
This table contains hundreds of thousands of records though.