Re: SQL Question - Mailing list pgsql-novice

From Stephen Clouse
Subject Re: SQL Question
Date
Msg-id 5d0ee2170601091542s6d59526agfa89137793151245@mail.gmail.com
Whole thread Raw
In response to SQL Question  (<operationsengineer1@yahoo.com>)
Responses Re: SQL Question  (<operationsengineer1@yahoo.com>)
List pgsql-novice
On 1/6/06, operationsengineer1@yahoo.com <operationsengineer1@yahoo.com> wrote:
and another sql question...

greatly simplified info:

t_sn
sn_id
sn

t_inspect
inspect_id
sn_id (fkey)
inspect_pass (boolean)

i want to display all sns where there is not a single
instance of inspect_pass = t

This should get you what you're looking for:

SELECT sn FROM t_sn
WHERE sn_id NOT IN
    (SELECT sn_id FROM t_inspect
     WHERE inspect_pass = t)

--
Stephen Clouse <stephenclouse@gmail.com>

pgsql-novice by date:

Previous
From:
Date:
Subject: Re: SQL Question
Next
From: Bruce Momjian
Date:
Subject: Re: database ->xml