Re: I don't understand something...

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Alexander Pyhalov <alp(at)rsu(dot)ru>
Cc: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: I don't understand something...
Date: 2011-10-03 08:02:16
Message-ID: 20111003080216.GC4824@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 03, 2011 at 11:48:45AM +0400, Alexander Pyhalov wrote:
> On 10/03/2011 11:19, Achilleas Mantzios wrote:
> >Alexander, that's a classic one,
> >rewrite your last query as :
> >
> >SELECT count(employee_id) from employees where employee_id not in
> > (select manager_id from employees WHERE manager_id IS NOT NULL);
> >
> >NULLS semantics are sometimes not so obvious.
>
> Thanks.
> It's confusing, that IN check works as expected, but NOT IN works
> this way...

If I might plug:
http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2011-10-03 08:11:55 Re: [GENERAL] One-click installer, Windows 7 32-bit, and icacls.exe
Previous Message Magnus Hagander 2011-10-03 07:59:14 Re: [GENERAL] One-click installer, Windows 7 32-bit, and icacls.exe