Just my 2 cents here. The IN is CaSe sensitive, so a search for Smith will only return Smith, not smith (atleast not in the MySQL version I have here). Sounds trivial, however, if your allowing the user to enter a name, then its no longer trivial. On the other hand LIKE returns Smith, smith, sMiTh and any other variants, however, each queried name must be entered indivuially.... (The good with the bad I guess).
SELECT book FROM BooksAuthors AS B1 JOIN BooksAuthors AS B2 WHERE B1.Author LIKE '%Jones%' AND B2.Authors LIKE '%Smith%' AND B1.Book = B2.Book
To note here, the % sign is a wild card. Thus, if searching for John using John%, would also return items like Johny. Use only if you think it may be necessary.

You could make a for loop to create a query variable that, essentually does something like:
Assign select query up to WHERE
Loop through user input adding B1.Author LIKE '$input' AND B2.Authors LIKE '$input' (don't forget an AND or OR claus between each pass)
Add the AND B1.Book = B2.Book to the end of the variable, then run the query, process the output.

In reply to Re: Many-to-many relationships in databases by Delusional
in thread Many-to-many relationships in databases : SOLVED by CountZero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.