mysql select records greater than 3 months

前端 未结 3 1375
生来不讨喜
生来不讨喜 2020-12-29 06:37

I am trying to write a query to select all records from users table where User_DateCreated (datetime field) is >= 3 months from today.

Any

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 06:55

    If you want to ignore the time of day when a user was created you can use the following. So this will show someone created at 8:00am if you run Quassnoi's example query at 2:00pm.

    SELECT  *
    FROM    users
    WHERE   DATE(user_datecreated) >= DATE(NOW() - INTERVAL 3 MONTH)
    

提交回复
热议问题