SQL/PL-SQL Question

From: Frampton Steve R <3srf_at_qlink.queensu.ca>
Date: 1995/07/11
Message-ID: <3tuhjo$dpc_at_knot.queensu.ca>#1/1


Hello:

I would like to ask information on how to accomplish the following in either PL/SQL or in standard SQL:

Suppose I am given a start date and an end date of an employee absence.

For example:

    Start: 950101 End: 950331

With this information, I calculate the total number of working days. In my example, 64 days.

I have a table with date ranges, as in the example:

    Start End Loss

    950103  950106  0.0
    950120  950127  0.0
    950313  950317  0.0

The table indicates, that, if an absence spans any of the dates in the table, they should lose "0.0" absence credits (instead of 1.0)...therefore, in my example, insteading of losing 64 absence credits, the employee would only lose 49 credits (64 less 15 non-credit loss days). Please note that my "non-credit loss days" may span non-working days in the table (the January entries wrap over a Saturday/Sunday) and they should *not* be deducted.

I would like to know how to find out, given the start and end date, the total number of *working* days the range spans in the non-credit loss table.

Any information would be greatly appreciated. Thanks in advance!

-----------------------------------+-----------------------------------------

Steve Frampton                     | Phone:    (613) 547-5987, ext. 312 or 331
Computer Operator/Systems Clerk | Internet: frampton_at_admin.flarc.edu.on.ca Frontenac-Lennox & Addington RCSSB | DECNET: FLASSB::FRAMPTON
-----------------------------------+-----------------------------------------
Received on Tue Jul 11 1995 - 00:00:00 CEST

Original text of this message