Re: select where not in () fails

From: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: select where not in () fails
Date: 2018-09-21 15:20:16
Message-ID: 201809211620.16084.gary.stainburn@ringways.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

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=#

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2018-09-21 16:14:15 Re: select where not in () fails
Previous Message Pavel Stehule 2018-09-21 15:11:17 Re: select where not in () fails