Re: how does NOT work?

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Re: how does NOT work?
Date: 2002-04-24 16:50:53
Message-ID: Pine.LNX.4.21.0204241742520.965-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 24 Apr 2002, tony wrote:

> On Wed, 2002-04-24 at 17:55, ARP wrote:
> > > I guess select count(*) from individu where type2 is null will return 5717 (18417-12619-81)
> >
> > >Still don't understand the logic - I just want cells that don't start
> > >with "a" I don't care if they contain null values or not.
>
> > select count(*) from individu where type2 is null or type2 not like 'a%'
>
> "or" works here but not in some of the more complex joins I am doing
> elsewhere. I will be using "-" and "0" a lot more from now on!
>

I don't understand what you're saying now can we just restate the situation.

You have:

Query Giving
-------- ----------
SELECT count(*) from individu T
SELECT count(*) from individu WHERE type2 like 'a%' x
SELECT count(*) from individu WHERE type2 not like 'a%' y

where x + y != T

and, here is where I get uncertain:

SELECT count(*) from individu WHERE type2 like 'ar%' v
SELECT count(*) from individu WHERE type2 not like 'ar%' w

where v + w == T

But in another message you imply that you did have nulls present, so was your
'two letter' test incorrectly stated or was it that you weren't aware that
NULLs existed? (Only asking because although I can't see it happening if there
weren't any NULLs there must be a bug)

--
Nigel J. Andrews
Director

---
Logictree Systems Limited
Computer Consultants

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mario Weilguni 2002-04-24 17:24:29 temp space on different location
Previous Message Joel Burton 2002-04-24 16:13:06 Re: how does NOT work?