Joshua Beall wrote:
Hi All,
I have two tables in a children's program registration system, parent and
child. 1 row in the parent table corresponds to 1 or more rows in the child
table.
Right now, when I do
SELECT * FROM parent LEFT JOIN child ON parent.ID = child.parentID
I get multiple rows for each parent if they registered more than one child.
This is normal and expected I know, but I am wondering is there a way to
return the children on the *same* row, so that the first bit of the row is
the parent's information, and the second part of the row is something like
"child1.fname, child1.lname, child2.fname, child2.lname", etc.
I'm not really tied to LEFT JOIN if I have to use another syntax. I am also
not concerned about speed, because this query would be run at most a few
times per week by an admin. It can be inefficient - as long as it won't
crash the server! :-)
Any help?
Sincerely,
-Josh
Use GROUP BY with GROUP_CONCAT:
http://dev.mysql.com/doc/mysql/en/group-by-functions.html
HTH,
Wolfram
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]