Hello. I work with PHP. I have a table named books. In table books I have the book_name
with the name of the book, book_publisher
with the publisher's ID and book_author
with the author's ID. Besides the books table I have the books_author
table with the authors names and IDs and books_publisher
with the books publishers names and IDs.
I give my users 3 input fields that represents author name, book name and publisher name and a search button. They can input an author name, a book name and publisher name in the same search and I have to query my database and return the books names that have author name LIKE (%..%) inputted author name, book name LIKE the inputted book name and publisher name LIKE the inputted publisher name.
The problem is that I have stored only the author's id and publisher's id in my books table and I need to search by all three fields and exclude duplicates (books that were match by name and also by publisher).
Can anybody help me building this query ?