DB2获取上周日期的范围

    xiaoxiao2022-07-02  119

     SQL如下:

    select CURRENT_DATE - (DAYOFWEEK(CURRENT_DATE) + 5) DAY BEGIN_DATE, CURRENT_DATE - (DAYOFWEEK(CURRENT_DATE) - 1) DAY END_DATE FROM SYSIBM.DUAL;

    运行结果如下: 

     所用函数:

    dayofweek(exp) :取exp所在的那个周的第几天。 

    最新回复(0)