From: "Michel Cadot" <micadot@netcourrier.com>
Newsgroups: comp.databases.oracle.misc
Subject: Re: How to count working days?
Date: Wed, 8 Aug 2001 08:22:40 +0200
Organization: Guest of France Telecom Oleane's newsreading service
Lines: 32
Message-ID: <9kqlrh$q1$1@s1.read.news.oleane.net>
References: <9kp23c$sog$1@news.tpi.pl>
Reply-To: "Michel Cadot" <micadot@netcourrier.com>
NNTP-Posting-Host: 195.101.229.231
X-Trace: s1.read.news.oleane.net 997251761 833 195.101.229.231 (8 Aug 2001 06:22:41 GMT)
X-Complaints-To: abuse@oleane.net
NNTP-Posting-Date: Wed, 8 Aug 2001 06:22:41 +0000 (UTC)
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200



"Grzesiek" <grzesiek@altavista.net> a écrit dans le message news: 9kp23c$sog$1@news.tpi.pl...
> Hi!
> Sorry for such easy question but I've spent preety much time on that before
> asking for help .
>
> I've got DATE_1 in TABLE_1 and DATE_2 in TABLE_2.
> I've got table CALENDAR with 2 columns: DATE, WORKING_DAY [Y/N]
> All I need is a sql report with
> DATE_1, DATE_2 and WORKING_DAYS between these two dates.
>
> Thanks in advance,
> Grzesiek
>

You can do something like:

select a.date_1, b.date_2, sum(decode(c.working_day,'Y',1,0))
from calendar c,
     (select date_2 from table_2) b,
     (select date_1 from table_1) a
where c.date between a.date_1 and b.date_2
group by a.date_1, b.date_2
/

--
Have a nice day
Michel





