X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 26BC952C94 for ; Thu, 4 Aug 2005 10:41:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38776-05 for ; Thu, 4 Aug 2005 13:41:08 +0000 (GMT) Received: from qtm.net (mummra.qtm.net [216.163.32.14]) by svr1.postgresql.org (Postfix) with SMTP id 1B69552C99 for ; Thu, 4 Aug 2005 10:41:06 -0300 (ADT) Received: (qmail 31040 invoked from network); 4 Aug 2005 13:41:08 -0000 Received: from unknown (HELO ?192.168.0.110?) (mur@216.163.42.222) by mummra.qtm.net with SMTP; 4 Aug 2005 13:41:08 -0000 Message-ID: <42F21B44.1030505@endpoint.com> Date: Thu, 04 Aug 2005 09:42:28 -0400 From: Jeff Boes Organization: End Point User-Agent: Mozilla Thunderbird 1.0.5 (Windows/20050711) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pgsql-sql@postgresql.org Subject: Re: Breakdown results by month References: <2bffcc3305080211342745b1ab@mail.gmail.com> In-Reply-To: <2bffcc3305080211342745b1ab@mail.gmail.com> X-Enigmail-Version: 0.92.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.091 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200508/19 X-Sequence-Number: 22247 Henry Ortega wrote: > I have the ff table: > > id | total | effective | end_date > john 6 01-01-2005 02-28-2005 > john 8 03-01-2005 06-30-2005 > > How can I return: > id | total | effective | end_date > john 6 01-01-2005 01-31-2005 > john 6 02-01-2005 02-28-2005 > john 8 03-01-2005 03-31-2005 > john 8 04-01-2005 04-30-2005 > john 8 05-01-2005 05-31-2005 > john 8 06-01-2005 06-30-2005 I would look at writing a PL/PgSQL function that walks through the rows, generating substitute rows for the dates you want.