Re: select where not in () fails

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: select where not in () fails
Дата
Msg-id CAFj8pRAKAZggUfO1h5kSXus3i1KDsA8sFDtaHT9iYeEoN8kehQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: select where not in () fails  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql


pá 21. 9. 2018 v 17:20 odesílatel Gary Stainburn <gary.stainburn@ringways.co.uk> napsal:
On Friday 21 September 2018 16:11:17 Pavel Stehule wrote:
>  maybe some value emp_u_id from employees is NULL. It is expected behave
>
> http://blog.9minutesnooze.com/sql-not-in-subquery-null/
>
> Regards
>
> Pavel


Thanks for this.

As I said in my description, some values will be NULL. I just thought that
these would not be included in the select. I did not think that it would stop
the subselect from working

It is common issue. But it has sense.

Regards

Pavel

 

users=# select count(u_id) from users where u_id not in (select distinct
emp_u_id from employees where emp_u_id is not null);
 count
-------
   393
(1 row)

users=#

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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: Re: select where not in () fails
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: select where not in () fails