pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Luca Pireddu <lucap@shaw.ca>
To: pgsql-sql@postgresql.org
Subject: select multiple immediate values, but in multiple rows
Date: Mon, 14 Mar 2005 23:18:27 -0700
Message-ID: <200503142318.27510.lucap@shaw.ca> (raw)

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;

but I don't know the syntax to specify my set of constants.  I thought of 
doing
 select 1 union select 2 union select 3 union ... except ...
but I figure there must be a better way.  The size of the set would be 
anywhere between 1 and about 5 or 6 elements.  Is there a better way to do 
this?

Thanks.

Luca  



view thread (3+ messages)  latest in thread

Message-ID: <200503142318.27510.lucap@shaw.ca>
Permalink:  ../200503142318.27510.lucap@shaw.ca/
Also on:    postgresql.org/message-id/200503142318.27510.lucap@shaw.ca

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lucap@shaw.ca
  Subject: Re: select multiple immediate values, but in multiple rows
  In-Reply-To: <200503142318.27510.lucap@shaw.ca>

* 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