【问题标题】:Previous day of current_date() in Hue hiveHue 蜂巢中 current_date() 的前一天
【发布时间】:2023-09-07 21:43:01
【问题描述】:

我正在尝试编写一个查询,以使用前几天的“businessdate”记录从名为“businessdate”的列(格式为 YYYY-MM-DD,并且是字符串数据类型)返回记录我被困住了。我尝试了不同的东西,我收到了参数或匹配方法等错误消息。这可能很简单,我觉得很愚蠢。请帮忙!

查询;

Select businessdate from dbname
Where businessdate = current_date - 1

【问题讨论】:

    标签: sql date hive hiveql hue


    【解决方案1】:

    使用 date_sub 函数从 current_date 中减去一天:

    select businessdate 
      from dbname.tablename
     where businessdate = date_sub(current_date,1)
    

    【讨论】:

      最近更新 更多