mysql 距离今日,过去一年/一个月/一天 表达式

a表,时间字段为create_time

查询过去一年的数据

select * from a

where create_time between date_add(date(curdate()), interval -1 year) and date(curdate());

过去一个月

select * from a

where create_time between date_add(date(curdate()), interval -1 month) and date(curdate());

原文地址:https://www.cnblogs.com/littlebob/p/13456540.html