>Is there a limit to the number of inner join statements within an sql
>statement. I am using the following statement:
>
>SELECT DISTINCT suburb_def.Suburb, church_location.Name, church_location.URL
>
> FROM (suburb_def
> INNER JOIN church_location ON suburb_def.ID = church_location.Suburb)
> INNER JOIN (neighbour_def
> INNER JOIN suburb_map ON neighbour_def.ID = suburb_map.Neighbour) ON
>suburb_def.ID = suburb_map.Node
> WHERE ((suburb_map.Node) = $suburb)
> ORDER BY suburb_def.Suburb, church_location.Name;
>
>This seems to return an invalid result set when called from a php script
>
>Regards,
>
>Tim Lokot
Sir, you can't use a nested join between INNER JOIN and ON. The only
thing that can go between INNER JOIN and ON is a table name. With
inner joins, it doesn't matter what order the tables on joined in.
Rewrite your FROM clause so that you always have 'INNER JOIN <table
name> ON'. Or you can replace the INNNER JOINs with commas and move
the ON conditions to the WHERE clause.
Bob Hall
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
MySQL list magic words: sql query database
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php