我有一個數據庫與學生的表。該結構是這樣的與多個值的MySQL查詢
id name
--- -----
1 Tini
2 Eka
那麼該表的書籍
id title
--- ------
1 Cinderella's story
2 Pinochio
3 Mickey Mouse
然後借用
id students_id books_id
--- ------------ ---------
1 1 1,3
2 2 2,3
我如何獲得「蒂尼被借用灰姑娘的故事和米老鼠」? 我已經嘗試過這樣的查詢
select students.*, books.* , borrowing.*
(select books.title from borrowing
join books on books.id = borrowing.books_id
where books_.id = borrowing.books_id limit 1) as books_title
from borrowing
join students on students.id = borrowing.students_id
join books on books.id = borrowing.books_id
GROUP BY books.title
但它引發我一個錯誤