Re: why these results?

From: Wes James <comptekki(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: why these results?
Date: 2011-08-02 14:13:01
Message-ID: CAFjCMHtkoAj5hDKw_c2X76tqZDiUthx=g=nSwpdPCLhnVm-Bww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Yes. Thanks to all that responded. That was it.

-wes

On Mon, Aug 1, 2011 at 5:01 PM, Steve Crawford
<scrawford(at)pinpointresearch(dot)com> wrote:
> On 08/01/2011 03:50 PM, Wes James wrote:
>>
>> select count(*) from table;
>>
>> count
>> -------
>>    100
>> (1 row)
>>
>>
>> is correct
>>
>> select count(*) from table where col::text ~~* '%text%';
>>
>> count
>> -------
>>      1
>> (1 row)
>>
>> is correct.
>>
>> But now if I do:
>>
>>
>> select count(*) from table where col::text !~~* '%text%';
>> count
>> -------
>>   98
>> (1 row)
>>
>> Shouldn't it be 99?  That is out of 100 records there is one that has
>> "text" in column "col" so the !~~* should return 99 rows.  ??
>>
>> -wes
>>
> select count(*) from table where col is null;
>
> (null is neither equal nor not-equal to anything, even null)
>
> Cheers,
> Steve
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Charlie 2011-08-02 17:06:05 Re: [SQL] Help with regexp-query
Previous Message Steve Crawford 2011-08-01 23:01:30 Re: why these results?