【发布时间】:2021-11-19 08:44:06
【问题描述】:
base_table
month year
5 2021
10 2020
我想将“月”和“年”列组合成一个合适的日期列。
month_year
2021-05-01
2020-10-01
这似乎是一个重复的问题: Concatenate in PostgreSQL
我都试过了:
to_date(CONCAT(year::text, '/'::text, month::text), 'YYYY/MM') as month_year
和
to_date(CONCAT(year, '/', month), 'YYYY/MM') as month_year
但也许该解决方案在 Redshift 中不起作用。
【问题讨论】:
-
无效的操作:函数concat(字符变化,字符变化,字符变化)不存在;
-
make_date 似乎不适用于 PostGreSQL 8.0 (Redshift)
标签: sql amazon-web-services amazon-redshift