Re: Set Membership operator -- test group membership - Mailing list pgsql-general

From Igor Katrayev
Subject Re: Set Membership operator -- test group membership
Date
Msg-id 67622181058673409D58D1DA2B0457410A6D3D@aoos-nprb-sbs.aoos-nprb.local
Whole thread Raw
In response to Set Membership operator -- test group membership  (Sophie Yang <yangsophie@yahoo.com>)
List pgsql-general
Sophie,

The sql like this:
  select * from tbl1 where (a, b) in ((1, 20), (2, 30), (3, 50));
works very well in PostgreSQL 8,

Sincerely,

Igor Katrayev, Data Systems Manager
North Pacific Research Board
1007 West Third Avenue, Suite 100
Anchorage, AK 99501
Phone: 907-644-6700
Fax:   907-644-6780
igor.katrayev@nprb.org


-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Sophie Yang
Sent: Tuesday, June 14, 2005 11:09 AM
To: pgsql-general@postgresql.org
Cc: pgsql-novice@postgresql.org; pgsql-sql@postgresql.org
Subject: [GENERAL] Set Membership operator -- test group membership

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 8: explain analyze is your friend



pgsql-general by date:

Previous
From: Michal Hlavac
Date:
Subject: Re: suse 9.2
Next
From: Együd Csaba
Date:
Subject: How to set an expiration date for a WHOLE user account