红移日期添加

Redshift DateAdd

我想获取当月的第一个日期。

条件是:(当前月份 - 36)所以我写的像 DATEADD(month, -36, getdate()) 但它给出的日期像 2018-06-22 00:00:00 但我需要像 2018-06-01 00:00:00

这样的输出

Br, 萨蒂什

尝试 date_trunc:

date_trunc('month', DATEADD(month, -36, getdate()))