i have date field and i query for selecting Birthday before 7 days in mysql.
for example
if
birth = 1986-08-05
if now is 2012-07-30 this query alarm me.
or
birth = 1986-01-05
if now is 2012-12-30 this query alarm me.
birth is field of user_table.
解决方案
i find my select for this goal.
select *,birthdate,
concat(if(date_format(birthdate, '%m') = '12',date_format(curdate(), "%Y")
,date_format(now(), "%Y")),
date_format(date_add(curdate(), interval 7 day), '%Y')) as birthday
from users
HAVING birthday BETWEEN curdate() and date_add(curdate(), interval 7 day)
thanks from your help.