Re: [SQL] Set Membership operator -- test group membership

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Sophie Yang <yangsophie(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Set Membership operator -- test group membership
Date: 2005-06-19 08:48:12
Message-ID: Pine.GSO.4.63.0506191248020.1850@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-sql

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(at)postgresql(dot)org)
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jose Gonzalez Gomez 2005-06-19 16:16:34 Re: Foreign key to a view (UNION of two or more tables), any alternative?
Previous Message Gregory Youngblood 2005-06-19 05:30:26 Anyone use pgcluster in production?

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2005-06-19 12:25:45 Re: allowing ',' (comma) in float8
Previous Message Andreas Kretschmer 2005-06-19 07:58:45 Re: [despammed] allowing ',' (comma) in float8

Browse pgsql-sql by date

  From Date Subject
Next Message PFC 2005-06-19 10:36:03 Re: Dynamic PL/pgSQL
Previous Message Rajesh Kumar Mallah 2005-06-19 06:21:02 Re: partial index on non default tablespace syntax