使用SQL获取月份中的第三个星期五的日期(不使用级别功能),还有一个月的工作日和所有月份的第三个星期五,谢谢
这可以让您在2016年的所有月份中的每个月的第三个星期五。但是,我不确定为什么您要避免使用connect by and level。
with months as (select to_date('01/01/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/02/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/03/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/04/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/05/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/06/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/07/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/08/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/09/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/10/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/11/2016', 'dd/mm/yyyy') start_of_month from dual union all
select to_date('01/12/2016', 'dd/mm/yyyy') start_of_month from dual)
select start_of_month,
next_day(start_of_month - 1, 'FRIDAY') + 14 third_friday_in_month
from months;
至于您要获得一个月中的工作日数的要求,取决于您所说的“工作日”。你是说工作日吗?还是平日减去公众假期?还有吗
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句