我需要计算firebird base(ver 2.5)中两个日期之间的工作日
我有工作日的表(table_date)(日期,日期 - 免费/工作) 我有另一个表与start_date和end_date。 例如,我们有两个日期start_date = 2015-04-04和end_date = 2015-04-10 2015-04-05和2015-04-06日是免费的。 在这个日期之间是6天,但是4个工作日。
如何在基地计算?
答案 0 :(得分:1)
根据您提供的信息,我猜这样的事情应该有效:
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