Re: isnull or coalesce isn't working

Поиск
Список
Период
Сортировка
От Liz Bartlett
Тема Re: isnull or coalesce isn't working
Дата
Msg-id 3.0.5.32.20000604203636.00992cf0@mail.idyllmtn.com
обсуждение исходный текст
Ответ на isnull or coalesce isn't working  (Jochen Schmidt <jochen@joyce.giub.uni-bonn.de>)
Список pgsql-novice
>HI
>just started using postgres I want to do a select like the following.
>I have a table with two columns a and b, where sometimes data are missing.
>I want to do:
>SELECT ifnull(a,b) FROM table;
>
>==>ERROR:  No such function 'ifnull' with the specified attributes
>
>tried the same thing with isnull and coalesce, same error.

I would try:

SELECT a, b FROM table WHERE (a ISNULL) OR (b ISNULL);

On a related note:

I have a table with a column of type LOGICAL. Some rows have 't', some
have 'f' and some have a NULL value.

I wanted to select all the rows that were not TRUE.

Using a WHERE clause of feespaid != 't' only returned the rows where
the value was 'f'. (As did other variations of a single condition,
such as NOT(feespaid = 't').)

In the end, I had to add in a second check for the NULL value:

SELECT entryid FROM entriesspring2000 WHERE ((feespaid != 't') OR (feespaid ISNULL))

This to me seems counterintuitive. Is there any way I can ask for
the rows that do not have a TRUE value without having two conditions?

--Liz

----------------------------------------------------------------------
Liz Bartlett*http://www.khyri.com/            110 E. Wilshire Ave.#G-1
Idyll Mountain Internet*http://www.idyllmtn.com/   Fullerton, CA 92832
Virtual Dog Show Co-ordinator*http://www.dogshow.com/   (714) 526-5656
Tibetan Mastiff Web Site*http://www.tibetanmastiffs.com/

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

Предыдущее
От: Jochen Schmidt
Дата:
Сообщение: isnull or coalesce isn't working
Следующее
От: Steve Waldman
Дата:
Сообщение: large objects and printable docs