Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdmYX-0007yW-4B for pgsql-sql@arkaria.postgresql.org; Wed, 28 Nov 2012 18:40:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TdmYW-00054i-HB for pgsql-sql@arkaria.postgresql.org; Wed, 28 Nov 2012 18:40:20 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdmYU-00053Q-Vw for pgsql-sql@postgresql.org; Wed, 28 Nov 2012 18:40:19 +0000 Received: from mail-we0-f174.google.com ([74.125.82.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdmYT-0007l0-78 for pgsql-sql@postgresql.org; Wed, 28 Nov 2012 18:40:18 +0000 Received: by mail-we0-f174.google.com with SMTP id d7so4622246wer.19 for ; Wed, 28 Nov 2012 10:40:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=wJVuYSEGfkzS5EQeNvM5pSpfIsoLdXXfWAbknxnDJvs=; b=gx2mPR3LLEnr3YFyRv1O/V05RFjUTyzn9Lr+03Ki3XY89E+bVUwBRzsZYw2e+Ei0bI rCTLKNQieJEj+THGc94P3TbKRLGQNvZmPWZGW9s5DdQNtjCko24Z4oSFHgcb7pIJ+uf+ bxFkbwqWmVPqIkMTnZ1pILZga/MYmrH+woU6G2hTXVAVuAo92LiMIVaUZY/PIKwKT77H y3guxWBTUKafxTBfZYiUyW/67eetoV7MFAmTOwpkaF26ZrUgwkxjbt2rCMZtLhria8lj b6pdTPAd97dhyIg0gQaJmOIxkYNEXhZrQNGSTA40AQGeiGJQOiaY8izq6QCFD9ThTiqD ryIg== Received: by 10.216.195.146 with SMTP id p18mr7367722wen.174.1354128015751; Wed, 28 Nov 2012 10:40:15 -0800 (PST) Received: from [93.108.20.237] (237.20.108.93.rev.vodafone.pt. [93.108.20.237]) by mx.google.com with ESMTPS id bz12sm9117284wib.5.2012.11.28.10.40.06 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 28 Nov 2012 10:40:14 -0800 (PST) References: In-Reply-To: Mime-Version: 1.0 (iPhone Mail 8L1) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Message-Id: <2829F543-88A7-496D-AB22-6D5ECBBB4633@gmail.com> Cc: "pgsql-sql@postgresql.org" X-Mailer: iPhone Mail (8L1) From: Oliver d'Azevedo Cristina Subject: Re: Joining several rows into only one Date: Wed, 28 Nov 2012 18:42:27 +0000 To: JORGE MALDONADO X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org You need to use the array_agg() and array_to_string() functions.=20 Best, Oliver Enviado via iPhone Em 28/11/2012, =C3=A0s 06:33 PM, JORGE MALDONADO e= screveu: > I have a SELECT statement that gives me a result like this: >=20 > SONG ARTIST > ----------------------------------- > Song1 Artist1 > Song1 Artist2 > Song1 Artist3 > Song2 Artist2 > Song3 Artist4 > Song4 Artist1 > Song5 Artist4 >=20 > As you can see, the same song may belong to more than one artist, and thi= s is fine. What I would like to do is NOT to get several rows, one for each= different artist, but to join all of the artists in one column and display= only one row. > Is this possible? >=20 > Respectfully, > Jorge Maldonado >=20 --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql