Re: SQL Question

From: <operationsengineer1(at)yahoo(dot)com>
To: Stephen Clouse <stephenclouse(at)gmail(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: SQL Question
Date: 2006-01-10 01:08:43
Message-ID: 20060110010843.36072.qmail@web33301.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

--- Stephen Clouse <stephenclouse(at)gmail(dot)com> wrote:

> On 1/6/06, operationsengineer1(at)yahoo(dot)com
> <operationsengineer1(at)yahoo(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Brendan Duddridge 2006-01-10 07:01:19 With auto vacuum, is analyze still necessary?
Previous Message Bruce Momjian 2006-01-09 23:59:02 Re: database ->xml