I got stuck with this statement.
I have two tables:
Author: author_id, author_name
Wrote: book_id, author id
I want to get book_id with all its authors in one field, concatenating all the authors' names.
For instance, let's suppose we have
I want to make a select statement which brings:
10 John, Mike, Lisa
use the GROUP_CONCAT function
Putting r937's suggestion into a query, you get:
SELECT w.book_id, GROUP_CONCAT(a.author_name) AS authors
FROM Wrote AS w
INNER JOIN Author AS a ON w.author_id = a.author_id
GROUP BY w.book_id;