I am trying to make a Java Thread, this thread have to delete from an MySQL database all the records, older than 7 days.
In my table i have a column that contain the date like this: 2013-10-28 17:00:00
.
And to do this i want to use JDBI library. and my question here if any one could give me and example of the query that i have to write.
I think it should look like this:
h.execute("Delete from MyTable where date >= (dt.now.dayofmonth() -7)
h.execute("DELETE FROM MyTable WHERE NOW() >= ADDDATE(date, INTERVAL 7 DAY);");