How to remove the MYSQL records that were created more than 3 minutes ago?



  • I'm not strong on dates. The table contains a field with a recording date (mydate) in TIMESTAMP.

    Should we remove the records that were created more than 3 minutes (180 seconds) ago?

    DELETE FROM table WHERE NOW() - mydate > 180
    

    It doesn't work. ♪ ♪



  • This should solve the problem:

    DELETE FROM table WHERE  mydate < (NOW()  - INTERVAL 3 MINUTE) 
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2