SQL to return the number of working days between 2 passed in dates

前端 未结 6 1601
礼貌的吻别
礼貌的吻别 2021-01-07 08:10

I need to write an sql query that returns the number of Working days (Monday - Friday) between two given dates.

I was wondering what would be the most efficient way

6条回答
  •  天命终不由人
    2021-01-07 08:44

    It can be achieved by:

    select  SUM(decode ( to_CHAR((sysdate-ROWNUM),'DY'),'SUN',0,'SAT',0,1)) from all_objects where rownum < sysdate -  (sysdate -9) 
    

提交回复
热议问题