oracle获取过去两年的今天时间

获取过去两年的今天时间:

SELECT last_day(ADD_MONTHS(ADD_MONTHS(sysdate,-12), ROWNUM - 1)) as monthlist
FROM DUAL
CONNECT BY ROWNUM <=
months_between(SYSDATE,
ADD_MONTHS(sysdate,-12)) + 1;


select extract(year from sysdate) from dual
union
select extract(year from sysdate) -1 from dual
union
select extract(year from sysdate) -2 from dual;


select add_months(sysdate,-12) from dual
union
select add_months(sysdate,-24) from dual ;



select last_day(to_date('201409','yyyymm')) from dual;

没有更多推荐了,返回首页