4
votes

I need to count working days between two date in firebird base(ver 2.5)

I have table(table_date) with working days (date, day--Free/Working) and i have another table with start_date and end_date. For example we have two dates start_date=2015-04-04 and end_date=2015-04-10 Day 2015-04-05 and 2015-04-06 are Free. Between this dates is 6 days but 4 is working days.

how to calculate this in base?

1

1 Answers

1
votes

Based on the information you provided, I would guess that something like this should work:

select a.start_date, a.end_date, 
   (select count(*)
    from working_days
    where "DATE" between a.start_date and a.end_date
    and "DAY" = 'working') as nr_of_workdays
from start_end a