【问题标题】:How to calculate end of week in SQL?如何在 SQL 中计算周末?
【发布时间】:2016-04-19 05:32:22
【问题描述】:

给定日期格式 yyyy-mm-dd,我将如何计算周末的星期六?对于一个星期天,我想计算下一周的星期六。我正在使用 teradata 15。

【问题讨论】:

    标签: teradata


    【解决方案1】:

    当您在星期六运行查询时,您希望得到同一天还是下一个星期六?

    next_day(date-1, 'sat')  -- same day
    
    next_day(date, 'sat')    -- next Saturday
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-02
      • 2019-04-02
      • 2020-09-04
      • 1970-01-01
      • 2015-08-17
      • 1970-01-01
      • 2015-04-01
      • 1970-01-01
      相关资源
      最近更新 更多