i have a database with 3 tables in a many-to-many relationship. one is the books, the other is the authors and the third is their junction (used to join the two). the database is MySQL
a book can be made by many authors, and authors make many books.

now i want to get the books (with authors) like say 8 books at a time. i made this query:
//first table
SELECT * FROM `books`
//join the junction
LEFT JOIN books_authors ON books.book_id = books_authors.book_id
//join the authors
LEFT JOIN authors ON books_authors.author_id = authors.author_id
//limit to 8, start at S
limit S, 8
works fine when one-to-one. but when a book has more authors, like say 3 each, the sql result will have 8 x 3 rows in total (due to the 2D nature of the result) for all the details. but the query still clips it to 8 – i don’t get all the details.
how to get 8 books with all details?
You could limit the number of books in a subquery: