Oracle - 在未来12个月内全部显示

时间:2015-05-13 22:47:38

标签: oracle

我试图在接下来的12个月内提取所有数据。我唯一能在网上找到的就是" addmonths"但是无法得到它,不确定它是否因为Start_date列中的日期是DD / MM / YYYY?

select number, start_date from wo_table
where start_date between sysdate and addmonths(sysdate,12) 

2 个答案:

答案 0 :(得分:0)

SELECT "number", start_date
FROM   wo_table
WHERE  start_date BETWEEN SYSDATE
                      AND ADD_MONTHS( SYSDATE, 12 );

或者

SELECT "number", start_date
FROM   wo_table
WHERE  start_date BETWEEN SYSDATE
                      AND SYSDATE + INTERVAL '1' YEAR;

答案 1 :(得分:-1)

想出来以备将来参考,它有助于其他人:

select number, start_date from wo_table

where start_date between sysdate and sysdate+365

简单:)