select question - Mailing list pgsql-sql

From george young
Subject select question
Date
Msg-id 20020828161241.50a8512d.gry@ll.mit.edu
Whole thread Raw
Responses Re: select question  (Wei Weng <wweng@kencast.com>)
Re: select question  (eric soroos <eric-psql@soroos.net>)
List pgsql-sql
[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 isnot 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"
 


pgsql-sql by date:

Previous
From: Jeff Eckermann
Date:
Subject: Re: Retrieving the new nextval...
Next
From: Wei Weng
Date:
Subject: Re: select question