Amazon Athena表包含一个列'closed_date'。
closed_date
2002-05-12
2003-03-26
现在我需要查一下结帐后的天数。
我想做的是:
select
extract (current_date - closed_date) as day
from athena_table
理想情况下,它应该返回(2021-07-27)- (2002-05-12)= 7,016 Days
您可以使用DATE_DIFF(unit, timestamp1, timestamp2)
命令:
SELECT
DATE_DIFF('day', CURRENT_DATE, closed_date) as days
FROM athena_table