pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: george young <gry@ll.mit.edu>
To: pgsql-sql@postgresql.org
Subject: select question
Date: Wed, 28 Aug 2002 16:12:41 -0400
Message-ID: <20020828161241.50a8512d.gry@ll.mit.edu> (raw)

[postgreql 7.2, linux]
I have a table T with columns run, wafer, and test:
   T(run text, wafer int, test text)
Given a run and a set of wafers, I need the set of tests that match
*all* the specified wafers:

run	wafer	test
a	1	foo
a	2	foo
a	3	foo
a	3	bar

E.g.
  Given run 'a' and wafers (1,3) I should get one row: foo, since only foo matches both 1 and 3.
  Given run 'a' and wafers (3) I should get two rows: foo,bar, since both foo and bar match 3.

Is there some neat way to do this in a single query?

Puzzled,
	George


-- 
 I cannot think why the whole bed of the ocean is
 not one solid mass of oysters, so prolific they seem. Ah,
 I am wandering! Strange how the brain controls the brain!
	-- Sherlock Holmes in "The Dying Detective"



view thread (10+ messages)  latest in thread

Message-ID: <20020828161241.50a8512d.gry@ll.mit.edu>
Permalink:  ../20020828161241.50a8512d.gry@ll.mit.edu/
Also on:    postgresql.org/message-id/20020828161241.50a8512d.gry@ll.mit.edu

 · 

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: gry@ll.mit.edu
  Subject: Re: select question
  In-Reply-To: <20020828161241.50a8512d.gry@ll.mit.edu>

* 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