返回A,B兩個員工聘用日期之間的工作天數
create table test as
select level as id
from dual
connect by level<500;
select sum(case
when to_char(min_hd+test.id-1,'DY','NLS_DATE_LANGUAGE=American') in(‘SAT’,'SUN')
then 0
else 1
end) as 工作天數
from (select min(hiredate) as min_hd,max(hiredate) as max_hd
from tab
where name in('A','B')) x,test
where test.id<=max_hd-min_hd+1;