sql - SQL Athena 获取过去 12 个月的数据
问题描述
我需要获取过去 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
解决方案
推荐阅读
- ios - iOS 应用内是否允许 Shopify 网络结账?
- angular - 使用变量初始化的 Angular FormControl Validator Min 不会随变量更改而更新
- java - 从字符串末尾获取所有换行符的正则表达式是什么
- image - Firebase 存储的图像链接返回 null - Flutter
- python - Tkinter gui 仅在调整窗口大小时绘制图形
- r - R中的语法问题
- javascript - 如何在 TypeScript/Angular 中测试类型?
- azure-devops - yaml 发布管道的触发器
- java - 0 在 Hikari CP 中连接重置后的活动连接
- python - Python holtwinter: ValueError: Series 的真值不明确。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()