From: Richard Huxton <dev@archonet.com>
To: lucap@personainternet.com
Cc: pgsql-sql@postgresql.org
Subject: Re: select multiple immediate values, but in multiple rows
Date: Tue, 15 Mar 2005 08:18:59 +0000
Message-ID: <42369A73.3050502@archonet.com> (raw)
In-Reply-To: <200503142318.27510.lucap@shaw.ca>
References: <200503142318.27510.lucap@shaw.ca>
Luca Pireddu wrote:
> Hello all. I'd like to write a query does a set subtraction A - B, but A is
> is a set of constants that I need to provide in the query as immediate
> values. I thought of something like
>
> select a from (1,2,3.4)
> except
> select col_name from table;
richardh=> SELECT * FROM foo;
a
---
1
2
3
(3 rows)
richardh=> SELECT * FROM foo WHERE a NOT IN (1,2);
a
---
3
(1 row)
Run some tests with nulls in the column and the constant list too so you
understand what happens in those cases.
--
Richard Huxton
Archonet Ltd
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: dev@archonet.com, lucap@personainternet.com
Subject: Re: select multiple immediate values, but in multiple rows
In-Reply-To: <42369A73.3050502@archonet.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