Re: [SQL] Joining several rows into only one

2012-11-28 Thread David Johnston
> -Original Message- > From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql- > ow...@postgresql.org] On Behalf Of Oliver d'Azevedo Cristina > Sent: Wednesday, November 28, 2012 1:42 PM > To: JORGE MALDONADO > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL]

Re: [SQL] Joining several rows into only one

2012-11-28 Thread Oliver d'Azevedo Cristina
You need to use the array_agg() and array_to_string() functions. Best, Oliver Enviado via iPhone Em 28/11/2012, às 06:33 PM, JORGE MALDONADO escreveu: > I have a SELECT statement that gives me a result like this: > > SONG ARTIST > --- > Song1 Artist1

Re: [SQL] Joining several rows into only one

2012-11-28 Thread Jonathan S. Katz
On Nov 28, 2012, at 1:33 PM, JORGE MALDONADO wrote: > I have a SELECT statement that gives me a result like this: > > SONG ARTIST > --- > Song1 Artist1 > Song1 Artist2 > Song1 Artist3 > Song2 Artist2 > Song3 Artist4 > Song4 Artist1

[SQL] Joining several rows into only one

2012-11-28 Thread JORGE MALDONADO
I have a SELECT statement that gives me a result like this: SONG ARTIST --- Song1 Artist1 Song1 Artist2 Song1 Artist3 Song2 Artist2 Song3 Artist4 Song4 Artist1 Song5 Artist4 As you can see, the same song may belong to more tha