Re: Conactenating text with null values

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: Conactenating text with null values
Дата
Msg-id 1099655471.6361.80.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: Conactenating text with null values  (Oliver Elphick <olly@lfix.co.uk>)
Ответы Re: Conactenating text with null values  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Список pgsql-general
[snip]
> SELECT TRIM(TRIM(TRIM(COALESCE(s_house,'') || ' ' ||
> COALESCE(s_post_dir,'')) || ' ' || COALESCE(s_street ,'')) || ' ' ||
> COALESCE(s_suffix,'')) FROM parcels WHERE s_pin = '1201703303520';
>
> The TRIMs are to remove surplus spaces from inside the result string.
Avoiding the inner trims:

SELECT TRIM(
  COALESCE(s_house || ' ','')
  || COALESCE(s_post_dir || ' ','')
  || COALESCE(s_street || ' ','')
  || COALESCE(s_suffix,'')
) FROM parcels WHERE s_pin = '1201703303520';

Looks a bit more understandable :-)

Cheers,
Csaba.

>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org


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

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: TSearch2: Problems with compound words and stop words
Следующее
От: Antony Paul
Дата:
Сообщение: Characters used for pattern matching with like