Re: SQL Question

From: Stephen Clouse <stephenclouse(at)gmail(dot)com>
To: "operationsengineer1(at)yahoo(dot)com" <operationsengineer1(at)yahoo(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: SQL Question
Date: 2006-01-09 23:42:23
Message-ID: 5d0ee2170601091542s6d59526agfa89137793151245@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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)

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

In response to

  • SQL Question at 2006-01-07 00:02:53 from operationsengineer1

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2006-01-09 23:59:02 Re: database ->xml
Previous Message operationsengineer1 2006-01-09 23:28:42 Re: SQL Question