显示超过 3 个工作日的职位

Show jobs over 3 BUSINESS DAYS old

有人可以帮助我修改 SQL 代码以显示超过 3 个工作日的工作吗?

我有以下代码:

select
central_enquiry.enquiry_number,
central_enquiry.enquiry_time,
central_enquiry.officer_code,
type_of_service.service_code,
type_of_service.service_name,
enquiry_subject. subject_code,
enquiry_subject.subject_name,
central_site.site_name,
central_enquiry.enquiry_address,
central_enquiry.enquiry_desc,
enquiry_status.enq_status_code,
enquiry_status.enq_status_name,
central_enquiry.log_effective_date,
central_enquiry.follow_up_date,

CASE
when round((SYSDATE - central_enquiry.enquiry_time),2) >=3 then 'Over 3 days'
else ''
end as Days_since_reported


from
central_enquiry
inner join enquiry_subject on enquiry_subject.subject_code = central_enquiry.subject_code
inner join type_of_service on type_of_service.service_code = enquiry_subject.service_code
inner join enquiry_status_log on central_enquiry.enquiry_number = enquiry_status_log.enquiry_number and central_enquiry.enquiry_log_number = enquiry_status_log.enquiry_log_number
inner join enquiry_status on enquiry_status.enq_status_code = enquiry_status_log.enq_status_code
inner join central_site on central_site.site_code = central_enquiry.site_code


where
type_of_service.service_code = 'ECPE' and
round((SYSDATE - central_enquiry.enquiry_time),2) >=3 and
central_enquiry.officer_code = 'BSO' and
central_enquiry.outstanding_flag = 'Y'


order by central_enquiry.enquiry_number

这显示了根据当前日期超过 3 天前记录的所有作业。

where  round((SYSDATE - central_enquiry.enquiry_time),2) >=3 

但是我希望它只显示超过 3 个工作日之前记录的工作 - 所以如果一个工作是在 2 月 13 日星期四记录的 - 它只会在超过相同时间时显示在报告中时间2月18日星期二

您需要按以下方式操作您的条件:

where round((SYSDATE - central_enquiry.enquiry_time),2) 
- case when to_char(SYSDATE,'dy') in ('mon','tue') then 2 else 0 end >=3

干杯!!