[SQL] Aggregate function to build 2-d array

2006-11-15 Thread Steven Murdoch
I would like to aggregate several rows of a query, maintaining the relative order. Is there an other way to achive the same result? I have an alternative construction, but I am not convinced it will work in all cases. For example, with the setup below: -- Concatenate elements of type t into arra

Re: [SQL] Sorting items in aggregate function (thanks)

2006-09-15 Thread Steven Murdoch
On Tue, Sep 12, 2006 at 04:37:55PM -0400, Tom Lane wrote: > Note that if you need to GROUP in the outer query, it's best to sort the > inner query's output first by the outer query's grouping: ... Great - this works fine. Thanks also to the other people who replied. Steven. -- w: http://www.cl.

[SQL] Sorting items in aggregate function

2006-09-12 Thread Steven Murdoch
I would like to concatenate sorted strings in an aggregate function. I found a way to do it without sorting[1], but not with. Here is an example of a setup and what I could like to achieve. Does anyone have suggestions on what is the best way to get the desired result? Thanks, Steven. CREATE TAB