Search code examples
mysqldelete-row

MySQL Query to delete rows whose timestamp is older than current timestamp


I am looking for a query that is able to delete all rows from a table in a database where timestamp is older than the current date/time or current timestamp.

Would really appreciate some help out here urgently!

Here's the query I am using but as I thought it ain't working:

delete from events where timestamp<CURRENT_TIMESTAMP{);

Solution

  • delete from events where timestamp < NOW()
    

    should be enough.