메인>>유머

mysql 최근 3개월 데이터 검색

2022-01-25 16:55:00 2597


select * from t_user where time>DATE_SUB(CURDATE(), INTERVAL 1 WEEK)        --一周
select * from t_user where time>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)       --三月
select * from t_user where time>DATE_SUB(CURDATE(), INTERVAL 1 YEAR)        --一年

delete from g5_write_table where wr_datetime < DATE_SUB(CURDATE(), INTERVAL 3 MONTH)