as an aside, if you are interested in some theory behind this type of problems, the following book is a must: Chris date, Hugh Darwen, and Nikos Lorentzos: "Temporal Data and the Relational Model" Morgan Kaufmann Publishers, ISBN 1-55860-855-9. they introduce the concept of "packing" and "unpacking" data over the time dimension -- which is the generalization of the issue here. Kind regards, Lex. --------------------------------------------- visit my website at http://www.naturaljoin.nl --------------------------------------------- From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Daniel Fink Sent: Monday, August 02, 2004 18:01 To: oracle-l@xxxxxxxxxxxxx Subject: Re: how to generate the output w/o using temp table Somehow, you need to iterate through a list of months between the start and end dates and find all records that fall within that range. If you have a calendar type table, you can use that. If not, you have to get creative. I've included some code below (part stolen from other posters, part from my own twisted mind). *IF* the number of months requested is greater that the number of rows in the vacation table, it will *not* work. A better solution would be to code it in PL/SQL or another language. Regards, Daniel Fink -- Binary/unsupported file stripped by Ecartis -- -- Type: text/x-vcard -- File: Lex de Haan.vcf ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request@xxxxxxxxxxxxx put 'unsubscribe' in the subject line. -- Archives are at //www.freelists.org/archives/oracle-l/ FAQ is at //www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------