【发布时间】:2020-08-13 11:43:53
【问题描述】:
我需要获取过去 12 个月的数据。我在 AWS Athena 中使用 SQL。以下是我的代码:
CREATE
OR REPLACE VIEW response_view AS
SELECT
"cust"."customer_id",
"cust"."event_triggered_date"
FROM
(
db.population_view pop
INNER JOIN new_db.manual_response_view cust ON ("pop"."customer_id" = "cust"."customer_id")
)
WHERE "cust"."event_triggered_date" > current_date - interval '12' month
给我一个错误:cannot be applied to varchar, date
event_triggered_filed 是一个字符串
这是日期字段的结构:2019-12-04 00:00:00.000
【问题讨论】:
-
这表明
event_triggered_date被存储为字符串。修复你的数据模型! -
感谢您的评论,我会更加感谢一些帮助 - 这就是我在 SO 上发布我的问题的原因。
-
EVENT_TRIGGERED_DATE的结构是什么?你能给我们一些样本数据吗? @Chique_Code -
使用提供的示例编辑了我的问题。
标签: sql amazon-web-services date amazon-athena