Re: [GENERAL] Join field values

2007-06-12 Thread Erwin Brandstetter
On Jun 7, 9:49 pm, [EMAIL PROTECTED] (Jerry Sievers) wrote: No sense in writing your own func for this; the feature is already provided. select array_to_string(array(select * from generate_series(1,5)), ','); Tell me about redundant efforts! :) Regards Erwin

Re: [GENERAL] Join field values

2007-06-07 Thread Jerry Sievers
veejar [EMAIL PROTECTED] writes: Hello! I have such field in my table: field1 --- 1 2 3 4 5 I want to get such result from select: '1,2,3,4,5' - join all values in field1 with ',' // result must be varchar. No sense in writing your own func for this; the feature is

Re: [GENERAL] Join field values

2007-06-06 Thread Erwin Brandstetter
On Jun 5, 10:14 pm, Erwin Brandstetter [EMAIL PROTECTED] wrote: CREATE OR REPLACE FUNCTION f_concat_comma(text, text) (...) LANGUAGE 'plpgsql' STABLE IMMUTABLE; There's a typo. Should be: LANGUAGE 'plpgsql' IMMUTABLE; Regards Erwin ---(end of

[GENERAL] Join field values

2007-06-05 Thread veejar
Hello! I have such field in my table: field1 --- 1 2 3 4 5 I want to get such result from select: '1,2,3,4,5' - join all values in field1 with ',' // result must be varchar. Help to write SELECT-query for this task.

Re: [GENERAL] Join field values

2007-06-05 Thread Jeff Davis
On Tue, 2007-06-05 at 19:33 +0300, veejar wrote: Hello! I have such field in my table: field1 --- 1 2 3 4 5 I want to get such result from select: '1,2,3,4,5' - join all values in field1 with ',' // result must be varchar. Look into writing a simple function:

Re: [GENERAL] Join field values

2007-06-05 Thread Ragnar
On þri, 2007-06-05 at 19:33 +0300, veejar wrote: Hello! I have such field in my table: field1 --- 1 2 3 4 5 I want to get such result from select: '1,2,3,4,5' - join all values in field1 with ',' // result must be varchar. Help to write SELECT-query for this task.

Re: [GENERAL] Join field values

2007-06-05 Thread Erwin Brandstetter
On Jun 5, 7:39 pm, [EMAIL PROTECTED] (Ragnar) wrote: create an aggregate function and use that in your select.http://www.postgresql.org/docs/8.2/static/sql-createaggregate.html Of course you could do that. And it would look like that: CREATE OR REPLACE FUNCTION f_concat_comma(text, text)