problem with subselect: NOT IN

Поиск
Список
Период
Сортировка
От Kevin L
Тема problem with subselect: NOT IN
Дата
Msg-id 20010402191045.38794.qmail@web9601.mail.yahoo.com
обсуждение исходный текст
Ответы Re: problem with subselect: NOT IN  (Patrik Kudo <kudo@partitur.se>)
Re: problem with subselect: NOT IN  (Peter Eisentraut <peter_e@gmx.net>)
Re: problem with subselect: NOT IN  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: will trillich
Дата:
Сообщение: Re: function to operate on same fields, different records?
Следующее
От: Philip Hallstrom
Дата:
Сообщение: Re: bitwise again