Delete all rows with timestamp older than x days

后端 未结 2 624
醉酒成梦
醉酒成梦 2020-12-02 13:09

I want to delete all the rows with timestamp older than 180 days from a specific table in my database.

I\'ve tried the this:

DELETE FROM on_search WH         


        
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 13:39

    DELETE FROM on_search 
    WHERE search_date < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 180 DAY))
    

提交回复
热议问题