pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@myrealbox.com>
To: Aaron Bingham <bingham@cenix-bioscience.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Generating a range of integers in a query
Date: Wed, 13 Jul 2005 19:20:55 +0900
Message-ID: <053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com> (raw)
In-Reply-To: <l87jfvcbml.fsf@lynx.cenix-bioscience.com>
References: <l87jfvcbml.fsf@lynx.cenix-bioscience.com>


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





view thread (4+ messages)  latest in thread

Message-ID: <053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com>
Permalink:  ../053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com/
Also on:    postgresql.org/message-id/053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: grzm@myrealbox.com, bingham@cenix-bioscience.com
  Subject: Re: Generating a range of integers in a query
  In-Reply-To: <053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com>
  References: <l87jfvcbml.fsf@lynx.cenix-bioscience.com> <053899DD-536A-4B3F-87B0-8961FDD38315@myrealbox.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox