Suppose I have Author(id, name), Book(id, name), Book_Author(bookid, authorid), Book_Reader table(bookId, authorId) tables.
AUthor(id, name) ======== 1 | James 2 | Ivan 3 |John 4 |Harry Book(id, name) ============= 1 | Introducing Mysql 2 | Hibernate tutorials Book_Author(bookId, authorId) ========= 1 | 1 2 | 3 Book_reader(bookId, authorId) ============= 1 | 1 1 | 3 1 | 4
where bookAuthor table represents the author of the book and book reader represents the authors read that book.
Now I want the query which will return me book, author of the book and authors list read that book.
Bookname Author Readers ================================================ Introducing Mysql James James,John,Harry
Or I want all the books where author is James or Reader is James.. Thanks,