Re: SELECT WHERE NOT, is not working

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: SELECT WHERE NOT, is not working
Дата
Msg-id 200501051459.34598.scrawford@pinpointresearch.com
обсуждение исходный текст
Ответ на Re: SELECT WHERE NOT, is not working  (MargaretGillon@chromalloy.com)
Список pgsql-general
On Wednesday 05 January 2005 2:51 pm, MargaretGillon@chromalloy.com
wrote:
> Thanks, Ragnar,
>
> You are right in what is happening. The code was supposed to be
> sending '' but it is sending NULL instead. I see now -- in
> PostgreSQL to look for any record without the 'X' I have to use a
> combined condition because a NULL is not included in a !=
> statement.
>
> select count(*) from resource where reengine is NULL or NOT
> (reengine = 'X') ;

Or use the coalesce statement (picks the first non-null argument):
select count(*) from resource where coalesce(reengine, '') != 'X';

Cheers,
Steve


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SELECT WHERE NOT, is not working
Следующее
От: Jeffrey Melloy
Дата:
Сообщение: Re: Index on a view??