| From: | Kent Thomas <kent(at)solarbee(dot)com> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | null vs empty string |
| Date: | 2010-06-30 12:21:54 |
| Message-ID: | 8ABE6777-076F-4B3D-8B41-96B42A73009C@solarbee.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
I have the following query:
SELECT * FROM "sales_projects" WHERE (((sales_projects.prospect ILIKE E'%rancho murieta%') OR (sales_projects.prospect_type ILIKE E'%rancho murieta%') OR (sales_projects.application ILIKE E'%rancho murieta%') OR (sales_projects.project ILIKE E'%rancho murieta%') OR (sales_projects.city ILIKE E'%rancho murieta%') OR (sales_projects.state ILIKE E'%rancho murieta%') OR (sales_projects.project_status ILIKE E'%rancho murieta%')) AND (((sales_projects.project_status != E'Dead') AND (sales_projects.project_status != E'Ordered')) AND ((sales_projects.status IN (E'Active',E'Expired')) AND (sales_projects.kind = E'Project'))))
Yes, it is ugly, but that's not the issue. This query returns just one record when I would expect it to return two. The only difference in the two records is in the sales_projects.project_status field. One record has an empty string, the second has a null value. The NULL value in sales_projects.project_status is not returned.
Can someone explain why the NULL value in sales_projects.project_status field does not fit this query?
Secondly, can you offer some advice to EXCLUDE records where sales_projects.project_status is Ordered and Dead?
Thanks a million for any help.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rob Richardson | 2010-06-30 12:40:22 | Re: null vs empty string |
| Previous Message | Michael Wood | 2010-06-30 11:58:39 | Re: PLPERLU help |