From: Volkan YAZICI <yazicivo@ttnet.net.tr>
To: Steven Murdoch <psql+Steven.Murdoch@cl.cam.ac.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sorting items in aggregate function
Date: Tue, 12 Sep 2006 21:24:39 +0300
Message-ID: <20060912182439.GB1373@alamut> (raw)
In-Reply-To: <20060912154628.GB4991@cl.cam.ac.uk>
References: <20060912154628.GB4991@cl.cam.ac.uk>
On Sep 12 04:46, Steven Murdoch wrote:
> I would like to concatenate sorted strings in an aggregate function. I
> found a way to do it without sorting[1], but not with.
If the array elements will be made of integers, then you can use sort()
procedure comes with intarray contrib module. For instance,
SELECT concat(T.sorted_arr)
FROM (SELECT sort(arr) FROM tbl) AS T (sorted_arr);
If related column will also include text values, you can create a
suitable sort() procedure for text[] type and use it instead.
Regards.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: yazicivo@ttnet.net.tr, psql+Steven.Murdoch@cl.cam.ac.uk
Subject: Re: Sorting items in aggregate function
In-Reply-To: <20060912182439.GB1373@alamut>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox