Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mike wrote:
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

Then you probably have email addresses that exist of white space only. You should probably put a constraint on that if undesirable.


Try using a regular expression like so:

SELECT first_name,work_email
FROM tb_contacts
WHERE work_email !~ '^[[:space:]]*$';


-- Alban Hertroys MAG Productions

T: +31(0)53 4346874
F: +31(0)53 4346876
E: alban@xxxxxxxxxxxxxxxxx
W: http://www.magproductions.nl

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux