is there an elegant way, using either mySQL or an array, to determine if any entry is less than X seconds from any other without having to test each one?
I am working on a program that detects irregularities in an awards program database. Employees are awarded bonuses for taking a quiz. The quiz takes about five minutes to complete.
A few times we have had someone beat our traps.
I want to be able to scan our mySQL database to check each employee's activity in the prize file and flag if the employee was awarded bonuses too quickly (which would indicate fraud). I have written the code to test unusual monthly total bonuses or an unusual total number of bonuses but I would also like to test how close together the bonus awards were.
Obviously I can pull each occurrence out of the database and test it against the previous entry but I am hoping there an elegant way to determine if any entry is less than X seconds from any other without having to test each one? Can this be done with mySQL or, if all of the times are loaded into an array, is there a way to determine if the difference between any two values is less than X ?
Brian