Jennifer Goodie" <[EMAIL PROTECTED]> writes:

> You didn't switch the aliases around, you just switched the join order.
> This will provide unexpected results.  In order to understand it, you
should
> read up on left joins.
> http://www.mysql.com/doc/en/JOIN.html
............................
Thank you.  But...

// the query

$verify = "select ft.topic_id, ft.topic_title from forum_posts as fp left
join forum_topics as ft on fp.topic_id = ft.topic_id where fp.post_id =
$_GET[post_id]";
...........................

My question: why - or how can - the columns ft.topic_id and ft.topic_title
come from the table forum_posts?

In the original schema, there is no column called topic_title in the table
called forum_posts.

When I change the following to read:

$verify = "select ft.topic_id, ft.topic_title from forum_topics as ft left
join forum_posts as fp on fp.topic_id = ft.topic_id where fp.post_id =
$_GET[post_id]";

It works fine.

/*Roughly translated: Select the column ft.topic_id along with the column
ft.topic_title from the table called forum_topics which we'll call ft.  Then
join the table called forum_topics onto the table called forum_posts and
match the records where topic_id corresponds in both tables along with
post_id corresponds in both tables.*/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to