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
|
Список | 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 по дате отправления: