X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1DC6E5645C for ; Tue, 15 Mar 2005 06:20:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18183-03 for ; Tue, 15 Mar 2005 06:19:56 +0000 (GMT) Received: from pd4mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by svr1.postgresql.org (Postfix) with ESMTP id BAF0756451 for ; Tue, 15 Mar 2005 06:19:52 +0000 (GMT) Received: from pd5mr8so.prod.shaw.ca (pd5mr8so-qfe3.prod.shaw.ca [10.0.141.184]) by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0IDD00CL3QUSX0Z4@l-daemon> for pgsql-sql@postgresql.org; Mon, 14 Mar 2005 23:18:28 -0700 (MST) Received: from pn2ml3so.prod.shaw.ca ([10.0.121.147]) by pd5mr8so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0IDD00IKMQUSR7C0@pd5mr8so.prod.shaw.ca> for pgsql-sql@postgresql.org; Mon, 14 Mar 2005 23:18:28 -0700 (MST) Received: from S01060050ba4264e9.ed.shawcable.net (S01060050ba4264e9.ed.shawcable.net [68.148.222.61]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0IDD00I3KQUS5N@l-daemon> for pgsql-sql@postgresql.org; Mon, 14 Mar 2005 23:18:28 -0700 (MST) Date: Mon, 14 Mar 2005 23:18:27 -0700 From: Luca Pireddu Subject: select multiple immediate values, but in multiple rows To: pgsql-sql@postgresql.org Reply-To: lucap@personainternet.com Message-id: <200503142318.27510.lucap@shaw.ca> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Content-disposition: inline User-Agent: KMail/1.7.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.8 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200503/208 X-Sequence-Number: 20687 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