MySQL Forums
Forum List  »  Stored Procedures

Insert on time difference greater than
Posted by: Manny B
Date: May 17, 2016 11:21AM

Hi,

I have a python script that logs codes to a database via serial input. Is it possible to have a storage procedure that checks the last instance `receiver` and blocks the insert if the time difference is greater than 10 seconds.

At the moment I'm using this query to delete them at the end of the day.

DELETE b
FROM code_reader a
JOIN code_reader b ON a.tag_number= b.tag_number AND a.receiver=b.receiver
WHERE TIME_TO_SEC( TIMEDIFF(b.time,a.time)) BETWEEN 1 AND 10

Thank you

Manny

Options: ReplyQuote


Subject
Views
Written By
Posted
Insert on time difference greater than
2124
May 17, 2016 11:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.