Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql calculate working days between two dates excluding weekends and holidays

-- All dates between 01/07/2021 and 15/07/2021 excluding weekends
SELECT CAL_DATE
FROM (
         SELECT to_date('01/07/2021', 'DD/MM/YYYY') + ROWNUM - 1 AS CAL_DATE
         FROM ALL_OBJECTS
         WHERE ROWNUM <= to_date('15/07/2021', 'DD/MM/YYYY') 
                             - to_date('01/07/2021', 'DD/MM/YYYY') + 1)
WHERE to_char(CAL_DATE, 'DY', 'NLS_DATE_LANGUAGE=AMERICAN') NOT IN ('SAT', 'SUN');
Comment

PREVIOUS NEXT
Code Example
Sql :: select last 30 days sql 
Sql :: mysql search table in all databases 
Sql :: search mysql database for column 
Sql :: sql foreign key 
Sql :: mysql terminal run sql file 
Sql :: create mysql database on windows 
Sql :: sql date format 
Sql :: sql current date 
Sql :: split string from comma in sql 
Sql :: mysql change timestamp on update 
Sql :: postgresql connection string c# 
Sql :: mysql delete duplicate rows but keep one 
Sql :: sql server alter table add column tinyint 
Sql :: sql #region 
Sql :: CONVERT time string into 12 hours in sql 
Sql :: oracle sql drop column if exists 
Sql :: getdate function in postgresql 
Sql :: primary key multiple 
Sql :: mysql json query 
Sql :: oracle sql concatenate results into string 
Sql :: postgresql not case sensitive where in 
Sql :: SQL server how to see user permissions on objects 
Sql :: postgresql get date from datetime 
Sql :: how to get date in sql 
Sql :: Converting mysql tables to charset utf8mb4 
Sql :: postgresql filter on 
Sql :: postgres update single column 
Sql :: mysql min value row 
Sql :: createdb with postgresql on ubuntu 
Sql :: sql get duplicates by composite 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =