From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
---|---|
To: | mike <mike(at)redtux1(dot)uklinux(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: When is a blank not a null or '' |
Date: | 2005-02-02 10:26:57 |
Message-ID: | 4200AAF1.1020900@magproductions.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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:
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 != '';
--
Alban Hertroys
MAG Productions
T: +31(0)53 4346874
F: +31(0)53 4346876
E: alban(at)magproductions(dot)nl
W: http://www.magproductions.nl
From | Date | Subject | |
---|---|---|---|
Next Message | Troels Arvin | 2005-02-02 10:31:01 | Re: When is a blank not a null or '' |
Previous Message | Jeff Davis | 2005-02-02 10:16:46 | Re: Wierd memory problem with Apache / PHP. Related to |