On Mon, Sep 05, 2005 at 03:00:30AM +0300, Sterpu Victor wrote:
> Can I do something like this?
> SELECT sum(name) FROM table;
> 
> Where name is a text field.
> I know 'sum' doesn't work, but is there another solution?
> '||' is not good because it will take just 2 arguments.

Are you looking for an aggregate in particular or will any solution
suffice?  Here's a trivial example that works in 7.4 and later:

CREATE TABLE foo (name text);

INSERT INTO foo VALUES ('Alice');
INSERT INTO foo VALUES ('Bob');
INSERT INTO foo VALUES ('Carol');
INSERT INTO foo VALUES ('Dave');

SELECT array_to_string(ARRAY(SELECT name FROM foo), '');
  array_to_string  
-------------------
 AliceBobCarolDave
(1 row)

If you need an aggregate then search the archives; examples have
been posted before.

-- 
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to