* Thus wrote Anthony Ritter ([EMAIL PROTECTED]):
> 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?

The dont.  ft is aliased to forum_topic it has nothing to do with
form_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.*/

There are a lot of thing wrong with your summary.  What you are
doing is selecting *all* rows from ft.  include any rows from fp that
have the same topic_id where fp has a post_id of the $_GET
variable.

This query makes absolutly no sense, in real world application.

btw, this topic is completely off-topic, you might be able to get
better assistance with this query on the mysql list.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

Reply via email to