[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
SQL question
Hello guru's -
I hope you don't mind a Sql question. In the statement below, you will see
"A.check_dt - 3". I am looking for a way, within SQL, to subtract 3 business
days (M-F), ie., not count Saturday or Sunday. The statement below includes
the weekends. Any thoughts?
SELECT
A.COMPANY,
A.PAYGROUP,
TO_CHAR(A.PAY_END_DT,'YYYY-MM-DD'),
TO_CHAR(A.CHECK_DT,'YYYY-MM-DD'),
A.check_dt - 3,
FROM PS_PAY_CALENDAR A
where A.pay_confirm_run = 'N'
and (A.check_dt >= sysdate and A.check_dt<= (sysdate + 7))
and company not = 'ASI'
order by 1, 2, 3