日期:2014-05-17 浏览次数:21010 次
SELECT row_number() over(ORDER BY m.groupid DESC) rn,
MIN(m.t_date) start_date,
MAX(m.t_date) end_date
FROM (
SELECT '201211'
------解决方案--------------------
to_char(LEVEL,'fm09') t_date,
to_char(to_date('201211'
------解决方案--------------------
to_char(LEVEL,'fm09'),'yyyymmdd') - 1, 'd') - 1 - LEVEL groupid
FROM dual
CONNECT BY LEVEL <= LAST_DAY(TO_DATE('201211', 'yymm')) - TO_DATE('201211', 'yymm') + 1
) m
GROUP BY m.groupid
ORDER BY m.groupid DESC
RN START_DATE END_DATE
---------- ---------- ---------
1 20121101 20121104
2 20121105 20121111
3 20121112 20121118
4 20121119 20121125
5 20121126 20121130