List:General Discussion« Previous MessageNext Message »
From:James Eaton Date:November 16 2006 4:11am
Subject:Concatenate a column in multiple rows into one column?
View as plain text  
I have a database with roughly the following structure:

album
--------------------------
albumid     INT
title       VARCHAR(255)

artist
--------------------------
artistid    INT
name        VARCHAR(255)

albumartist
--------------------------
albumid     INT
artistid    INT


From the above, you can see that any given album can have more than one 
artist.  For instance:

album title: A Meeting by the River
artist name: Ry Cooder
artist name: V.M. Bhatt

I'd like to run a query that returns one row per album, but somehow also 
returns all of the artists associated with the album (ideally concatenated 
with an ampersand seperator).  Can this be done?

title                    artists
-----------------------  --------------------------
A Meeting by the River   Ry Cooder & V.M.Bhat

Thread
Concatenate a column in multiple rows into one column?James Eaton16 Nov
  • Re: Concatenate a column in multiple rows into one column?Dan Buettner16 Nov
RE: Concatenate a column in multiple rows into one column?emierzwa16 Nov