
Originally Posted by
PHPycho
... in your first query in which there was no any join condition between authors & book_authors
OMG, i am so sorry, my sample queries both had a typo!!
the first query should be like this --
Code:
FROM authors
INNER
JOIN book_authors
ON book_authors.author_id = authors.id
INNER
JOIN books
ON books.id = book_authors.book_id
WHERE author.id = 42
the second query should be like this --
Code:
FROM book_authors
INNER
JOIN books
ON books.id = book_authors.book_id
INNER
JOIN authors
ON authors.id = book_authors.author_id
WHERE author.id = 42
now which one makes more sense? which one will perform better?
Bookmarks