Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Gregory S. Williamson
: [GENERAL] Conactenating text with null values On Fri, Nov 05, 2004 at 12:51:11PM +0100, Csaba Nagy wrote: > [snip] > > SELECT TRIM(TRIM(TRIM(COALESCE(s_house,'') || ' ' || > > COALESCE(s_post_dir,'')) || ' ' || COALESCE(s_street ,''

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Csaba Nagy
Cool, this goes to my "util" mail folder :-) [snip] > But it's still too cumbersome. How about creating a new operator? With > the example below the query would simply be > > SELECT s_host ||~ s_post_dir ||~ s_street ||~ s_suffix > FROM parcels > WHERE s_pin = '1201703303520'; > > alvherre=

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Alvaro Herrera
On Fri, Nov 05, 2004 at 12:51:11PM +0100, Csaba Nagy wrote: > [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 rem

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Csaba Nagy
[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 tri

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Michael Kleiser
SELECT COALESCE(s_house,'') || COALESCE(s_post_dir,'') || COALESCE(s_street,'') || COALESCE(s_suffix,'') FROM parcels WHERE s_pin = '1201703303520'; Gregory S. Williamson schrieb: This is postgres 7.4 on a linux box ... I have driven myself to distraction trying to what ought to be easy. I have a

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Gregory S. Williamson
[mailto:[EMAIL PROTECTED] Sent: Fri 11/5/2004 2:15 AM To: Gregory S. Williamson Cc: [EMAIL PROTECTED] Subject:Re: [GENERAL] Conactenating text with null values On Fri, 2004-11-05 at 09:25, Gregory S. Williamson wrote: > This is postgres 7.4 on a linux box ... > > I have driven

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Oliver Elphick
On Fri, 2004-11-05 at 09:25, Gregory S. Williamson wrote: > This is postgres 7.4 on a linux box ... > > I have driven myself to distraction trying to what ought to be easy. > > I have a table with house number, street direction, street name and > street suffix as 4 columns. I want to paste them t

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Michael Fuhr
On Fri, Nov 05, 2004 at 01:25:07AM -0800, Gregory S. Williamson wrote: > SELECT s_house,s_post_dir,s_street,s_suffix FROM parcels WHERE s_pin = > '1201703303520'; > s_house | s_post_dir |s_street| s_suffix > -+++-- > 34643 || FIG

Re: [GENERAL] Conactenating text with null values

2004-11-05 Thread Richard Huxton
Gregory S. Williamson wrote: SELECT s_house,s_post_dir,s_street,s_suffix FROM parcels WHERE s_pin = '1201703303520'; s_house | s_post_dir |s_street| s_suffix -+++-- 34643 | | FIG TREE WOODS | So to get "34643 FIG TREE WOODS" what do I do ? SEL

[GENERAL] Conactenating text with null values

2004-11-05 Thread Gregory S. Williamson
This is postgres 7.4 on a linux box ... I have driven myself to distraction trying to what ought to be easy. I have a table with house number, street direction, street name and street suffix as 4 columns. I want to paste them together as one text string for use by another application. SELECT s