-1
Help to create a delete
with where
if the record has been inserted for more than 5 minutes.
I have the point marking table with the columns:
- cd_register - integer
- cd_enterprise - whole
- cd_matricula - integer
- dt_dot - varchar (because I am sending from the application
Java
asString
the date)
The idea is:
delete from ponto where "registro foi inserido há mais de cinco minutos"
or
delete from ponto where hora_atual - dt_ponto > cincoMinutos
Or if there is another alternative to this solution.
I need this because it’s a company rule that a person can only enter point record every five minutes. So this is a table that serves as a point marking time reference. In the java application, I do a check, if there is registration in this table is because the user registered point less than five minutes and can not enter another record.
Tells an example of what you want to do, it is easy to solve this, but sends the sample data
– Heitor Scalabrini
You should not check for duplicates, and if there is more than one record in less than 5 minutes, do the removal?
– Danizavtz
no, because it is necessary to avoid that there is more than one insertion by the same person in less than five minutes.
– Everton
Convert your string to a datetime field and use the function
DATE_SUB
withINTERVAL 5 MINUTES
.– anonimo
@Guilhermebrügger, thank you very much for the tip, really. And thank you all for collaborating on the solution!
– Everton