【发布时间】:2019-05-08 11:05:04
【问题描述】:
我试图在 SQL 语句中使用 Date_Trunc for MONTH 函数,但不知何故它不适合我。我正在尝试提取 2019 年 4 月 1 日之后发生的条目。Redshift 数据库中的原始日期格式是我尝试将其分组为月/年存储桶的格式:2019-04-08T00:13:20.000Z
输入
SELECT
client_id as user_id,
session_utc as job_date --(format:2019-04-08T00:13:20.000Z)
FROM table1 as hits
WHERE job_date >= DATE_TRUNC('month', 2019-04-01)
group by 1,2;
输出
"ERROR: function date_trunc("unknown", integer) does not exist Hint: No function matches the given name and argument types. You may need to add explicit type casts."
我做错了什么?
【问题讨论】:
标签: sql amazon-web-services amazon-redshift