Re: Generating a range of integers in a query - Mailing list pgsql-sql

From Michael Glaesemann
Subject Re: Generating a range of integers in a query
Date
Msg-id 053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com
Whole thread Raw
In response to Generating a range of integers in a query  (Aaron Bingham <bingham@cenix-bioscience.com>)
List pgsql-sql
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




pgsql-sql by date:

Previous
From: Aaron Bingham
Date:
Subject: Generating a range of integers in a query
Next
From: "Graham Vickrage"
Date:
Subject: Re: Copy user privileges