From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk> |
Cc: | pgsql-sql(at)lists(dot)postgresql(dot)org |
Subject: | Re: select where not in () fails |
Date: | 2018-09-21 16:14:15 |
Message-ID: | CAFj8pRAKAZggUfO1h5kSXus3i1KDsA8sFDtaHT9iYeEoN8kehQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
pá 21. 9. 2018 v 17:20 odesílatel Gary Stainburn <
gary(dot)stainburn(at)ringways(dot)co(dot)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=#
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-09-22 18:13:03 | Re: select where not in () fails |
Previous Message | Gary Stainburn | 2018-09-21 15:20:16 | Re: select where not in () fails |