SELECT all records that are 30 days old

后端 未结 4 716
盖世英雄少女心
盖世英雄少女心 2020-12-11 22:57

I need to SELECT all records that are 30 days old. I have the code below but it\'s not working. In updatestatus I have dates like 12/26/2011. I create a 30 day old date like

4条回答
  •  盖世英雄少女心
    2020-12-11 23:04

    If the time column is in timestamp then use below query.(use from_unixtime function)

    SELECT wd.* FROM `watchdog` as wd
    WHERE  from_unixtime(wd.timestamp) <= NOW() - INTERVAL 1 MONTH
    

提交回复
热议问题