Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Joins
Message
From
31/03/2000 09:03:14
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Joins
Miscellaneous
Thread ID:
00352894
Message ID:
00353268
Views:
14
>Hi all:
> Is there a max joins in Foxpro one can have ?
> I have a simple sql statement with five joins and it is giving me syntax error.

Just to expand on what the others said, you can do what you want with nested joins as you have it, but when you do so, you have to list the ON clauses in reverse order. That is, the first ON should link the last two tables in the FROM list. Then, the next ON clause should link that result (meaning one of the last two tables) to the third table from the end of the list, and so one, working your way back to the beginning.

On the whole, it is easier to use what I call the sequential syntax, like this:

FROM Table1 ;
JOIN Table2 ;
ON Table1.Field = Table2.Field ;
JOIN Table3 ;
ON Table2.Field = Table3.Field

etc.

It makes the query much more readable. The nested syntax is best only when you're dealing with a truly hierarchical structure, that is, a parent-child-grandchild situation.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform