- 获取最近七天,其中
CREATE_TIME
改为实际表中存储时间的字段
1 | select count(id) from table where date_sub(curdate(), interval 7 day) <= date(CREATE_TIME) |
- 获取最近半年
1 | select count(id) from table where date_sub(curdate(), interval 6 month) <= date(CREATE_TIME) |
- 获取最近一年
1 | select count(id) from table where date_sub(curdate(), interval 1 year) <= date(CREATE_TIME) |