Re: Combining text fields

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Combining text fields
Дата
Msg-id 200310171704.48986.josh@agliodbs.com
обсуждение исходный текст
Ответ на Combining text fields  (Doug Silver <dsilver@urchin.com>)
Список pgsql-novice
Doug,

> I just want to confirm that this is the correct behavior for the return
value
> when combining text fields together.  If one of the fields is NULL, then the
> return value of field1+field2 also becomes NULL.  If this is correct, is the
> proper way to get around this to use a default value of '' for such fields?

Use "COALESCE", e.g.:

SELECT street1 || COALESCE(street2, '') || COALESCE(street3, '')

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco


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

Предыдущее
От: Doug Silver
Дата:
Сообщение: Combining text fields
Следующее
От: Daniel Staal
Дата:
Сообщение: Re: scaleable design for multiple value tuple