X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 61E6A5280C; Sun, 19 Jun 2005 05:48:34 -0300 (ADT) 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 87864-07; Sun, 19 Jun 2005 08:48:24 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6558B52896; Sun, 19 Jun 2005 05:48:16 -0300 (ADT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id j5J8mCfY001906; Sun, 19 Jun 2005 12:48:12 +0400 (MSD) Date: Sun, 19 Jun 2005 12:48:12 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Sophie Yang Cc: pgsql-general@postgresql.org, pgsql-novice@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [SQL] Set Membership operator -- test group membership In-Reply-To: <20050614190840.32862.qmail@web53706.mail.yahoo.com> Message-ID: References: <20050614190840.32862.qmail@web53706.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.33 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200506/879 X-Sequence-Number: 79587 Look contrib/intarray On Tue, 14 Jun 2005, Sophie Yang wrote: > Say I have a table tbl1 with two columns: > tbl1(a integer, b integer, c integer) > > I want to select the rows in which a and b are members > of a list of integer pairs. The SQL in my mind is > something like: > select * from tbl1 where (a, b) in ((1, 20), (2, > 30), (3, 50)); > > I know the SQL above does not work in PostgreSQL. I > wonder what is the proper way to use in PostgreSQL. I > tried "select * from tbl1 where (a, b) in ('{{1, 20}, > {2, 30}, {3, 50}}')", and it doesn't work either. > > Thanks! > Sophie > > > > __________________________________ > Yahoo! Mail Mobile > Take Yahoo! Mail with you! Check email on your mobile phone. > http://mobile.yahoo.com/learn/mail > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83