null vs empty string

Поиск
Список
Период
Сортировка
От Kent Thomas
Тема null vs empty string
Дата
Msg-id 8ABE6777-076F-4B3D-8B41-96B42A73009C@solarbee.com
обсуждение исходный текст
Ответы Re: null vs empty string  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
Re: null vs empty string  (Thom Brown <thombrown@gmail.com>)
Re: null vs empty string  (Frank Bax <fbax@sympatico.ca>)
Список pgsql-novice
I have the following query:

SELECT * FROM "sales_projects" WHERE (((sales_projects.prospect ILIKE E'%rancho murieta%') OR
(sales_projects.prospect_typeILIKE E'%rancho murieta%') OR (sales_projects.application ILIKE E'%rancho murieta%') OR
(sales_projects.projectILIKE E'%rancho murieta%') OR (sales_projects.city ILIKE E'%rancho murieta%') OR
(sales_projects.stateILIKE 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.statusIN (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.
Theonly difference in the two records is in the sales_projects.project_status field.  One record has an empty string,
thesecond 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.

В списке pgsql-novice по дате отправления:

Предыдущее
От: Michael Wood
Дата:
Сообщение: Re: PLPERLU help
Следующее
От: "Rob Richardson"
Дата:
Сообщение: Re: null vs empty string