jendaaa — 2011-04-18T15:36:25-04:00 — #1
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.
r937 — 2011-04-18T15:47:11-04:00 — #2
yes it can
however, we don't just hand out homework answers on this site, we make you figure it out
what you want is a LEFT OUTER JOIN, in which you try to find the books john has borrowed, and test for NULL in the WHERE clause, to find the ones he hasn't
that's a bigger hint than healdem gave you
jendaaa — 2011-04-18T15:55:13-04:00 — #3
thanks a lot, im just a bit confused thinking about it for a couple o hours....and man. pages werent the right thing to solve it for me