agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Gary Stainburn <gary.stainburn@ringways.co.uk>
To: pgsql-sql@lists.postgresql.org
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Subject: Re: select where not in () fails
Date: Fri, 21 Sep 2018 16:20:16 +0100
Message-ID: <201809211620.16084.gary.stainburn@ringways.co.uk> (raw)
In-Reply-To: <CAFj8pRDz6x=59Y118YnKhMDvCGedt+Soj5-0dDFQMHb4AwMiCw@mail.gmail.com>
References: <201809211608.41086.gary.stainburn@ringways.co.uk>
	<CAFj8pRDz6x=59Y118YnKhMDvCGedt+Soj5-0dDFQMHb4AwMiCw@mail.gmail.com>

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




view thread (5+ messages)  latest in thread

Message-ID: <201809211620.16084.gary.stainburn@ringways.co.uk>
Permalink:  ../201809211620.16084.gary.stainburn@ringways.co.uk/
Also on:    postgresql.org/message-id/201809211620.16084.gary.stainburn@ringways.co.uk

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gary.stainburn@ringways.co.uk, pgsql-sql@lists.postgresql.org, pavel.stehule@gmail.com
  Subject: Re: select where not in () fails
  In-Reply-To: <201809211620.16084.gary.stainburn@ringways.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox