表A
fid name birth
1 aaa 2009-09-28
2 bbb 2009-09-29
birth是生日日期,当前日期是2009-09-25
提前3天提醒,这个语句怎么写?即查询三天后的记录如今天日期是2009-09-25
查询三天后的记录,结果 是
1 aaa 2009-09-28
fid name birth
1 aaa 2009-09-28
2 bbb 2009-09-29
birth是生日日期,当前日期是2009-09-25
提前3天提醒,这个语句怎么写?即查询三天后的记录如今天日期是2009-09-25
查询三天后的记录,结果 是
1 aaa 2009-09-28
where birth between to_char(sysdate,'yyyy-mm-dd') and to_char(sysdate+3,'yyyy-mm-dd')
from A
where trunc(birth)-trunc(sysdate)=3;
from A
where trunc(birth)-trunc(sysdate)=3;
支持下面这种,当然要求你的birth字段是日期select *
from A
where trunc(birth)-trunc(sysdate)=3;
select * from ta
where to_char(birth,'YYYY-MM-DD') = to_char(sysdate+3,'YYYY-MM-DD')