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 CA6DE52ABF for ; Wed, 13 Jul 2005 07:21:13 -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 84324-08 for ; Wed, 13 Jul 2005 10:21:03 +0000 (GMT) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id 574FD529B1 for ; Wed, 13 Jul 2005 07:21:02 -0300 (ADT) Received: from [172.16.1.180] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.5 $ on Linux via secured & encrypted transport (TLS); Wed, 13 Jul 2005 04:20:59 -0600 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com> Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: Generating a range of integers in a query Date: Wed, 13 Jul 2005 19:20:55 +0900 To: Aaron Bingham X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/108 X-Sequence-Number: 22086 On Jul 13, 2005, at 6:13 PM, Aaron Bingham wrote: > This would be easy (in my case at least) if there were a way to > generate a table containing all integers between 1 and n, where n is > the result of a subquery. In my case, n will be at most a few > hundred. I would like to be able to generate this table as a > subquery. Any ideas? Take a look at generate_series(), available in v8.0 and above. http://www.postgresql.org/docs/8.0/interactive/functions-srf.html Michael Glaesemann grzm myrealbox com