I currently have a table of access logs similar to
LogID UserID BuildingID Date/Time
What I need to do is create a query to count the number of duplicate user entries based on the following 2 conditions:
- Time difference in excess of X minutes - X will be a parameter specified by the user
- OR each individual building for the user
For example, if I set a time difference of 5 minutes, then my results would be as follows:
UserID AccessCount ==================== 1 3 <-- +1 for timediff (ID 1,10) +1 for building (ID 11) 2 2 <-- +1 for timediff (ID 2,5) 3 2 <-- +1 for building (ID 3,4) 4 1 5 1 <-- duplicate ignored because DateDiff < 5min
Hope this makes sense.
To give some background, this concerns access to some of our buildings, and a business requirement has been adopted for some security analysis reports. In fact, we want to check access to specified time periods for duplicates (usually on weekends), but we must take into account the fact that some scroll points fail and require the user to scroll repeatedly. That is why I want dating as a swipe error, as a rule, to mean that the user will scroll several times in a very short time.
Any help is greatly appreciated, thanks in advance!
source share