Re: SQL Question - Mailing list pgsql-novice

From
Subject Re: SQL Question
Date
Msg-id 20060110010843.36072.qmail@web33301.mail.mud.yahoo.com
Whole thread Raw
In response to Re: SQL Question  (Stephen Clouse <stephenclouse@gmail.com>)
List pgsql-novice
--- Stephen Clouse <stephenclouse@gmail.com> wrote:

> 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)

perfect!  thank you Stephen!  so concise, too.
beautiful!

i was misapplying "not exists" and it was a mess.  i
had it displaying all or none of the sns.

my last hurdle is to make my query also sort by
inspection area...  and i'll attack that tomorrow.

thanks again.




__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com


pgsql-novice by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: database ->xml
Next
From: Brendan Duddridge
Date:
Subject: With auto vacuum, is analyze still necessary?