Sql 在Oracle中显示(2015年1月1日)到今天之间的所有日期
这是我的Sql 在Oracle中显示(2015年1月1日)到今天之间的所有日期,sql,oracle,date,Sql,Oracle,Date,这是我的 with a as (select 1 as k, to_date('01/01/2015', 'mm/dd/yyyy') as temp from dual), b as (select 1 as k, sysdate as t from dual) select * from a join b on a.k = b.k where a.temp between a.temp and b.t 现在,我想显示这两个日期之间的所有日期 我如何生成它 最好的,你离得太近了 with
with
a as
(select 1 as k, to_date('01/01/2015', 'mm/dd/yyyy') as temp from dual),
b as
(select 1 as k, sysdate as t from dual)
select * from a
join b on a.k = b.k
where a.temp between a.temp and b.t
现在,我想显示这两个日期之间的所有日期
我如何生成它
最好的,你离得太近了
with
a as
(select 1 as k, to_date('01/01/2015', 'mm/dd/yyyy') as temp from dual),
b as
(select 1 as k, sysdate as t from dual)
select a.temp + level - 1 result from a --> this
join b on a.k = b.k
where a.temp between a.temp and b.t
connect by level <= b.t - a.temp + 1; --> this
结果是
RESULT
----------
01/01/2015
02/01/2015
03/01/2015
04/01/2015
<snip>
28/10/2019
29/10/2019
30/10/2019
31/10/2019
1765 rows selected.
SQL>