Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle sql select all days between two dates except weekends

-- 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

oracle sql all days except weekends

WHERE TO_CHAR(date_column, 'DY','NLS_DATE_LANGUAGE=AMERICAN') NOT IN ('SAT', 'SUN')
Comment

PREVIOUS NEXT
Code Example
Sql :: Get a list of tables and the primary key 
Sql :: reset counter postgres 
Sql :: how to set all the time serveroutput on in oracle sql developer 
Sql :: how to get second highest salary in each department in sql 
Sql :: query inner join 
Sql :: mysql error the maximum column size is 767 bytes. 
Sql :: selecting specific day in colum sql 
Sql :: getting customers with no orders sql 
Sql :: mysql copy table rows from one database to another 
Sql :: SQL:RANK function to delete duplicate rows 
Sql :: last date for each user sql 
Sql :: sql alias 
Sql :: index postgres 
Sql :: row number sql 
Sql :: how to insert same table data using mysql query 
Sql :: identify rows with 2 same column value and delete duplicate mysql 
Sql :: view column type sql server 
Sql :: sql creating tables 
Sql :: description query in sql 
Sql :: creating a database sql 
Sql :: function plsql 
Sql :: sql server get week dates from week number 
Sql :: disable database droping sql 
Sql :: grant sql 
Sql :: connect laravel to mysql on mac 
Sql :: sql and operator 
Sql :: mysql dump database tables only 
Sql :: sqlite3.OperationalError: near "7": syntax error 
Sql :: like postgres 
Sql :: how to join result table in mysql 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =