General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only