From: Scott Marlowe <smarlowe@g2switchworks.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 11:54:30 -0500
Message-ID: <1121273670.8208.251.camel@state.g2switchworks.com> (raw)
In-Reply-To: <l87jfvcbml.fsf@lynx.cenix-bioscience.com>
References: <l87jfvcbml.fsf@lynx.cenix-bioscience.com>
On Wed, 2005-07-13 at 04:13, Aaron Bingham wrote:
> Hello,
>
> I've got an interesting problem: I need to select all possible values
> of an attribute that do /not/ occur in the database.
>
> 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 here:
http://www.postgresql.org/docs/8.0/interactive/functions-srf.html
specifically, the generate_series() function.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: smarlowe@g2switchworks.com, bingham@cenix-bioscience.com
Subject: Re: Generating a range of integers in a query
In-Reply-To: <1121273670.8208.251.camel@state.g2switchworks.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