Re: [GENERAL] combine multiple row values in to one row

2009-07-07 Thread David Fetter
On Tue, Jul 07, 2009 at 08:40:06AM -0700, David Fetter wrote: > On Tue, Jul 07, 2009 at 01:59:35AM +0430, Lee Harr wrote: > > > > Is there a generic way to do this? An aggregate maybe? > > The aggregate is called array_agg() and it's in 8.4. You can then > wrap array_to_string() around it and ge

Re: [GENERAL] combine multiple row values in to one row

2009-07-07 Thread David Fetter
On Tue, Jul 07, 2009 at 01:59:35AM +0430, Lee Harr wrote: > > Hi; > > I'm looking for a way to do this: > > > # \d tbl > Table "public.tbl" > Column | Type | Modifiers > +-+--- > idn| integer | > code | text| > # SELECT * FROM tbl; > idn | code > -

Re: [GENERAL] combine multiple row values in to one row

2009-07-07 Thread Hartman, Matthew
pital (613) 549- x4294 > -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Lee Harr > Sent: Monday, July 06, 2009 5:30 PM > To: pgsql-general@postgresql.org > Subject: [GENERAL] combine multi

Re: [GENERAL] combine multiple row values in to one row

2009-07-06 Thread Ivan Sergio Borgonovo
On Tue, 7 Jul 2009 01:59:35 +0430 Lee Harr wrote: > > Hi; > > I'm looking for a way to do this: > # select idn, magic() as codes FROM tbl; > idn | codes > -+-- >1 | A >2 | B, C >3 | A, C, E > (3 rows) > > > Right now, I use plpgsql functions, but each time I do it > I ha

[GENERAL] combine multiple row values in to one row

2009-07-06 Thread Lee Harr
Hi; I'm looking for a way to do this: # \d tbl Table "public.tbl" Column | Type | Modifiers +-+--- idn| integer | code | text| # SELECT * FROM tbl; idn | code -+-- 1 | A 2 | B 2 | C 3 | A 3 | C 3 | E (6 rows) # select idn,