James - you should be able to do this with the GROUP_CONCAT function:
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html

Dan


On 11/15/06, James Eaton <[EMAIL PROTECTED]> wrote:
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


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to