2017-03-06 86 views

回答

3

您可以使用公用表表達式。從這裏

複製的查詢:Creating a CTE in Oracle

with RTG_YEARS (YR) as (
    select to_date('2013-01-01', 'yyyy-mm-dd') from dual 
    union all select to_date('2013-12-31', 'yyyy-mm-dd') from dual 
    union all select to_date('2014-01-01', 'yyyy-mm-dd') from dual 
    union all select to_date('2014-12-31', 'yyyy-mm-dd') from dual 
    union all select to_date('2015-01-01', 'yyyy-mm-dd') from dual 
    union all select to_date('2015-12-31', 'yyyy-mm-dd') from dual 
) 
select * 
from RTG_YEARS 
cross join RTG_YEARS; 
+1

非常感謝你,@Evaldas! –