Re: When is a blank not a null or ''

From: mike <mike(at)redtux1(dot)uklinux(dot)net>
To: Alban Hertroys <alban(at)magproductions(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: When is a blank not a null or ''
Date: 2005-02-02 11:24:33
Message-ID: 1107343473.21155.18.camel@datacc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2005-02-02 at 11:26 +0100, Alban Hertroys wrote:
> mike wrote:
> > I have the following query (I have removed all nulls from the field as
> > test)
> >
> > SELECT first_name,work_email FROM tb_contacts WHERE
> > tb_contacts.work_email <>'';
> >
> > However I get loads of blank email addresses coming up
> >
> > anyone any ideas
>
> A blank is never a NULL:

I know, I meant visually a blank

>
> SELECT '' IS NULL;
> ?column?
> ----------
> f
> (1 row)
>
>
> Try this:
>
> SELECT first_name,work_email FROM tb_contacts WHERE
> tb_contacts.work_email IS NOT NULL;
>
> Or if there are also blanks among those e-mail addresses:
>
> SELECT first_name,work_email FROM tb_contacts WHERE
> tb_contacts.work_email IS NOT NULL AND tb_contacts.work_email != '';
>

no difference

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sean Davis 2005-02-02 11:30:10 Re: When is a blank not a null or ''
Previous Message mike 2005-02-02 11:20:03 Re: When is a blank not a null or ''