返回1-31,或者1-12,或者某个 select rownum from dual connect by rownum<31 就是connect by http://marcospring.iteye.com/blog/1721600 ORACLE获取某个时间段之间的月份列表 获取某个时间段之间的月份列表(示例返回2009-03到2010-03之间的月份列表) SELECT TO_CHAR(ADD_MONTHS(TO_DATE('2009-03','YYYY-MM'),ROWNUM-1…
declare @start date,@end date; set @start='2010-01-01'; set @end='2010-02-01'; --获取时间段内日期列表 select [day]=dateadd(day, number - 1, @start) from master.dbo.spt_values where type='P' and number <= datediff(day, @start,@end) + 1 and number>0…
1.查询某时间段内日期列表 select level,to_char(to_date('2013-12-31','yyyy-mm-dd')+level-1,'yyyy-mm-dd') as date_time from dual connect by level <=to_date('2014-01-03','yyyy-mm-dd')-to_date('2013-12-31','yyyy-mm-dd')+1 2.查询前两个月日期列表 SELECT T.DATE_ID FROM ( ,)+ row…