嗨,我有这个 mysql 表
id amount substart years subend
1 200 2012-01-10 1 2013-01-09
2 250 2012-02-15 2 2014-02-14
3 100 2012-02-11 1 2013-02-10
4 260 2012-03-22 3 2015-03-21
我想要的是在结束日期前一个月发出通知。当前查询是:
select count(subend) as count,curdate()
from subdur where status='active'
and (date_sub(subend,interval 1 month))>=curdate()
and (date_sub(subend,interval 1 month))<date_add(curdate(),interval 1 month)
order by subend;
该查询没有给我正确的答案。
提前致谢