Re: problem with subselect: NOT IN

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Kevin L <kevinsl(at)yahoo(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: problem with subselect: NOT IN
Date: 2001-04-02 19:55:23
Message-ID: Pine.LNX.4.30.0104022154020.1287-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kevin L writes:

> However, getting employees who have NOT sold something always
> returns zero rows:
>
> SELECT emp_id FROM employee WHERE emp_id NOT IN (SELECT emp_id
> >FROM workorder);

Are there any NULL values in workorder.emp_id? If so, you need to exclude
them (... FROM workorder WHERE emp_id IS NOT NULL).

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mike 2001-04-02 20:01:12 reindexing sequences
Previous Message Tom Lane 2001-04-02 19:54:35 Re: problem with subselect: NOT IN