SQL QUESTION
From: Jean-Marc Boivin <jmboivin_at_cti.ulaval.ca>
Date: Tue, 23 Nov 1993 19:44:38 GMT
Message-ID: <jmboivin.3.000EBEEA_at_cti.ulaval.ca>
Jean-Marc Boivin
System analyst
Universite Laval
Quebec, Canada
mail: jmboivin_at_cit.ulaval.ca
tel: (418) 656 3632
Received on Tue Nov 23 1993 - 20:44:38 CET
Date: Tue, 23 Nov 1993 19:44:38 GMT
Message-ID: <jmboivin.3.000EBEEA_at_cti.ulaval.ca>
Hi!
Please, help me with this SQL problem:
I have a table similar to this:
table_x
begin_date date,
end_date date
Suppose i have the following rows in this table:
begin_date end_date --------------------- --------------------------- 1-nov-93 10-nov-93 11-nov-93 13-nov-93 18-nov-93 30-nov-93
As you can see there is a break in the sequence of dates between the 13-nov-93 and the 18-nov-93 (ie: no row covert this period). I want a SQL statement which will return each existing row as a 'occupied period' and periods not covered by row as 'free period'. So the result should be like this:
begin_date end_date status ------------------- ------------------- ---------- 1-nov-93 10-nov-93 OCC 11-nov-93 13-nov-93 OCC 14-nov-93 17-nov-93 FREE 18-nov-93 30-nov-93 OCC
anybody know how to do it with a sql statement ?(please no PL*SQL since it will be used to build a view.)
Thank's
Jean-Marc Boivin
System analyst
Universite Laval
Quebec, Canada
mail: jmboivin_at_cit.ulaval.ca
tel: (418) 656 3632
Received on Tue Nov 23 1993 - 20:44:38 CET