pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sophie Yang <yangsophie@yahoo.com>
To: pgsql-general@postgresql.org
Cc: pgsql-novice@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Set Membership operator -- test group membership
Date: Tue, 14 Jun 2005 12:08:39 -0700 (PDT)
Message-ID: <20050614190840.32862.qmail@web53706.mail.yahoo.com> (raw)

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 



view thread (3+ messages)  latest in thread

Message-ID: <20050614190840.32862.qmail@web53706.mail.yahoo.com>
Permalink:  ../20050614190840.32862.qmail@web53706.mail.yahoo.com/
Also on:    postgresql.org/message-id/20050614190840.32862.qmail@web53706.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: yangsophie@yahoo.com, pgsql-general@postgresql.org, pgsql-novice@postgresql.org
  Subject: Re: Set Membership operator -- test group membership
  In-Reply-To: <20050614190840.32862.qmail@web53706.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox