Yonah Russ <[EMAIL PROTECTED]> wrote: > Hi, > I have two tables- books and copies > > every book has an id in the books table > every copy of a book has the books id and a copy id in the copies table > (1 row per copy) > > I want a list of all the books that don't have any copies meaning all > the book id's in books that don't match any book id's in copies. > > how can I do this?
Use LEFT JOIN. For example: SELECT .. FROM book_table LEFT JOIN copy_table ON book_table.id=copy_table.book_id WHERE copy_table.book_id IS NULL; http://dev.mysql.com/doc/mysql/en/Rewriting_subqueries.html -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]