【发布时间】:2018-05-08 14:28:17
【问题描述】:
我想选择 Teradata 中给定日期范围内的所有日期。
例如: sel all_dates where date_range between '2000-01-01' 和 '2014-01-01'
预期输出: 2000-01-02 , 2000-01-03, . . . 2014-01-01
任何人都可以建议这样做的逻辑是什么?
【问题讨论】:
我想选择 Teradata 中给定日期范围内的所有日期。
例如: sel all_dates where date_range between '2000-01-01' 和 '2014-01-01'
预期输出: 2000-01-02 , 2000-01-03, . . . 2014-01-01
任何人都可以建议这样做的逻辑是什么?
【问题讨论】:
这是一个日历表的任务,有一个内置的:
select calendar_date
from sys_calendar.calendar
where calendar_date between date '2000-01-01' and date '2014-01-01'
贵公司可能有自己的日历来满足特定需求。询问您的 DBa 它位于何处。
【讨论】: