Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sql minus two date and time between columns excluding weekends?

user8851230Mar 4 2020 — edited Mar 5 2020

I have this query and I would like to omit the weekends from the calculation. is this possible? 02/29 and 03/01 are a weekend.

SELECT rd.DATERECEIVED, ba.SCANDATE, CAST((rd.DATERECEIVED-ba.SCANDATE)*24 AS DECIMAL(16,2)) From SPRTKIN2.RECEIPT r JOIN SPRTKIN2.RECEIPTDETAIL rd on r.RECEIPTKEY = rd.RECEIPTKEY LEFT JOIN SPRTKIN2.BAXASNODDATA ba on r.externreceiptkey = ba.externreceiptkey
where rd.DATERECEIVED >= TRUNC(SYSDATE-1) AND rd.DATERECEIVED < TRUNC(SYSDATE)
AND r.STATUS = '11'
AND ba.SCANWHO is NOT NULL
AND ba.SCANDATE > (SYSDATE-90)

msdn1.jpg

This post has been answered by user8851230 on Mar 5 2020
Jump to Answer
Comments
Post Details
Added on Mar 4 2020
6 comments
1,350 views