Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011

    Unanswered: Select from multiple tables

    Hi, I have some troubles with select from multiple tables. There are 3 tables - books (id, name), borrow_log(id_book, id_user), users(id, name). All i want to do is select books that havent been borrowed by specific user (e.g. "John"). I wonder if it could be done w/o subqueries?
    Thanks in advance.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    look at the various permutations of the join construct
    MySQL :: MySQL 5.0 Reference Manual :: JOIN Syntax
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2011
    I went through it many times, but i cant get it to work. I have this query:

    select * from book as b
    left join borrow_log as bl on = bl.id_book
    left join users as u on u.id_users = cl.id_user
    where u.nick <> "John"

    but i dont know what to do so as it do not return books that John's already borrowed - there are still rows with the same book id but different user
    Last edited by Jedna; 04-18-11 at 15:15.

  4. #4
    Join Date
    Apr 2011
    Not sure if its gonna work but you can try this.

    FROM users,books.borrow_log

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts