Weekend days skip in SQL
GQJun 21 2010 — edited Jun 29 2010Dear All,
KI want to write one query where I want to see the request of one transaction. I want that report should display the working days count only and ignore weekend days. I want to run the query as following in which it says show the days difference from approval tp arrival date if greater than one week. I have put 7 but I want it should skip weekend days (2 days) for example if the transaction has happened on FRIDAY and Completed on TUESDAY it should tell it took 3 working days while ignoring Saturday and Sunday and tell 3 days only i.e. FRI, MON and TUE. I have written following query how to modify that to meet the above criteria? I would highly appreciate your response on this.
SELECT NAME, APPROVAL_DATE, PRINT_DATE, PRINT_DATE-APPROVAL_DATE, POST_DATE, POST_DATE-PRINT_DATE),ARRIVAL_DATE
FROM REPORT_TABLE
WHERE ARRIVED_DATE BETWEEN TO_DATE ('01062010', 'DDMMYYYY') AND TO_DATE ('20062010', 'DDMMYYYY') AND
ARRIVAL_DATE - APPROVAL_DATE > 7;
Thanks