【问题标题】:Select first day of month in presto在 presto 中选择每月的第一天
【发布时间】:2019-02-02 01:29:18
【问题描述】:

我正在尝试为 Presto(Hive 表)中的日期值选择一个月的第一天。我试过 TRUNC(date,'MM'),它在 Hive 中有效,但在 Presto 中无效。

【问题讨论】:

    标签: presto


    【解决方案1】:

    使用date_trunc('month', date_value)

    presto> select date_trunc('month', DATE '2018-05-24');
       _col0
    ------------
     2018-05-01
    (1 row)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-08
      • 2020-10-02
      • 1970-01-01
      • 2013-08-27
      • 2019-01-31
      • 2010-12-03
      • 2010-11-06
      • 1970-01-01
      相关资源
      最近更新 更多