Search Postgresql Archives

Re: Set Membership operator -- test group membership

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks! Well, it is time to upgrade my PostgreSQL
7.4.2. :)

Sophie

-----Original Message-----
From: "Igor Katrayev" <igor ( dot ) katrayev ( at )
nprb ( dot ) org> 
To: <pgsql-general ( at ) postgresql ( dot ) org> 
Subject: Re: Set Membership operator -- test group
membership 
Date: Tue, 14 Jun 2005 11:27:30 -0800 

--------------------------------------------------------------------------------

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


-----Original Message-----
From: pgsql-general-owner ( at ) postgresql ( dot )
org
[mailto:pgsql-general-owner ( at ) postgresql ( dot )
org] On Behalf Of Sophie Yang
Sent: Tuesday, June 14, 2005 11:09 AM
To: pgsql-general ( at ) postgresql ( dot ) org
Cc: pgsql-novice ( at ) postgresql ( dot ) org;
pgsql-sql ( at ) postgresql ( dot ) org
Subject:  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 




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux