problem with subselect: NOT IN

From: Kevin L <kevinsl(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: problem with subselect: NOT IN
Date: 2001-04-02 19:10:45
Message-ID: 20010402191045.38794.qmail@web9601.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

here's my scenario: table employee has emp_id and employee
details. table salesorder has emp_id and sales details.

The following works fine: (get all employees who have sold
something)

SELECT emp_id FROM employee WHERE emp_id IN (SELECT emp_id FROM
salesorder);

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

Has anyone encountered this before? I know the second query
should return something because the data is in the table.

thanks!

-Kevin

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Philip Hallstrom 2001-04-02 19:11:48 Re: bitwise again
Previous Message will trillich 2001-04-02 19:02:51 Re: function to operate on same fields, different records?