> -----Original Message-----
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]
> Sent: 13 August 2003 02:57
>
> 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?
You have a conceptual misconception. In effect, you need to read that query
as:
"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]"
In other words, the left join of the two tables is treated as a single
virtual table, from which you could select any column of either original
table.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php