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.

Re: [SQL] Sorting items in aggregate function

2006-09-12 Thread Osvaldo Rosario Kussama
Steven Murdoch escreveu: 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?

Re: [SQL] Sorting items in aggregate function

2006-09-12 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Tue, Sep 12, 2006 at 04:46:28PM +0100, Steven Murdoch wrote: >> 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? > Use the aggregate over an ordered su

Re: [SQL] Sorting items in aggregate function

2006-09-12 Thread Volkan YAZICI
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 instanc

Re: [SQL] Sorting items in aggregate function

2006-09-12 Thread Michael Fuhr
On Tue, Sep 12, 2006 at 04:46:28PM +0100, Steven Murdoch wrote: > 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? Use the aggregate over an ordered subquery: SELECT name, trim(concat(code || ' '))

[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