left join does not work, why?
| From: | PJ | Date: | Sat, 14 Mar 2009 23:51:27 +0000 |
| Subject: | left join does not work, why? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-290065@lists.php.net to get a copy of this message | ||
$sql1 = "SELECT b.id, b.title, b.sub_title, b.descr, b.comment,
b.bk_cover, b.copyright, b.ISBN, b.language, b.sellers, c.publisher, <---
CONCAT_WS(' ', first_name, last_name) AS Author
FROM book AS b
LEFT JOIN book_author AS ab ON b.id = ab.bookID
LEFT JOIN author AS a ON ab.authID=a.id
LEFT JOIN book_publisher as abc ON b.id = abc.bookID // <---
LEFT JOIN publishers AS c ON abc.publishers_id = c.id // <---
ORDER BY title ASC ";
$result1 = mysql_query($sql1, $db);
$bookCount = mysql_num_rows($result1);
If I remove "c.publisher," and comment out the two lines marked <---
the $result returns empty and I get the warning : mysql_numb_rows() not
a valid result.
What am I missing here?
--
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- pj@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php