我使用下面的代码生成epoch中的日期列表。但是,我希望列表中的最新日期等于unix_timestamp()的值。
-- generate list of id's
with t1 as
(
select row_number() over (order by order_id) as n from orders
limit 2000
),
-- generate date based on incremental id's
t2 as
(select
(getdate() - n+1) as date
from t1
)
select
extract(epoch from date) as date
from t2
where t2.date >= '2014-01-01'
order by date desc
我不知道如何将此列表中的最后一个值设为unix_timestamp()
答案 0 :(得分:0)
使用提取物引用时代
xder= [0, 0]
使用date_part
没有引号select extract('epoch' from timestamp date) as date
from t2
where t2.date >= '2014-01-01'
order by date desc