1 个工作日回到 SQL DB2
1 Working Day Back In SQL DB2
我需要 select 来自数据库的数据,日期是过去一天但在工作日。是否有特定的功能(Excel 有公式 =Workday)?
我正在使用 VBA 指令将数据从 DB2 下载到 excel。
这是我用于日历日的代码。
strSQL = "SELECT *"
strSQL = strSQL & " FROM PDB2I.DI_HIS_EXH_RAT_01"
strSQL = strSQL & " WHERE CAR_DT = CURRENT DATE - 1 DAY"
提前感谢任何指示
检查星期几并相应更改
select * from table_x where timestamp_x > (select PREV_WEEKDAY from(select sysdate as current_date,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-1 end as prev_weekday
from dual))
select *
from mytable
where mydate = current date -
(case when dayofweek(current date) = 1 then 2 -- sonntag
when dayofweek(current date) = 2 then 3 -- montag
else 1 end) days
我需要 select 来自数据库的数据,日期是过去一天但在工作日。是否有特定的功能(Excel 有公式 =Workday)?
我正在使用 VBA 指令将数据从 DB2 下载到 excel。
这是我用于日历日的代码。
strSQL = "SELECT *"
strSQL = strSQL & " FROM PDB2I.DI_HIS_EXH_RAT_01"
strSQL = strSQL & " WHERE CAR_DT = CURRENT DATE - 1 DAY"
提前感谢任何指示
检查星期几并相应更改
select * from table_x where timestamp_x > (select PREV_WEEKDAY from(select sysdate as current_date,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-1 end as prev_weekday
from dual))
select *
from mytable
where mydate = current date -
(case when dayofweek(current date) = 1 then 2 -- sonntag
when dayofweek(current date) = 2 then 3 -- montag
else 1 end) days