>I am getting error 1805 Too Many Subqueries when executing an SQL query.
>The help file says there is a limit of 2 subqueries.
>
>the select statement that failed has 6 sub-select statements, if I remove one it works fine. I also found if I keep the 6 sub-queries and remove a join condition from the where clause it also works fine.
>
>Basically if i have almost any combination of JOIN conditions and subqueries up to a total of 10 ( between them) it is OK, but as soon as I try for 11 it gives error 1805.
>
>I have found several ways around the problem , but was just wondering if someone could shed some light on this.
Let's see what we know about limits on SQL Select:
- The maximum number of joins per Select statement is nine (VFP help).
- There's a limit of nine UNIONs in a single query. (Hacker's Guide to VFP 6)
- You can have up to two subqueries at the same level (not nested) in the WHERE clause. (VFP help)
The last one is incorrect. A test in VFP 6 and VFP 7 shows that the number of subqueries is limited to nine also.
It seems to me that there's a limit of 10 tables per Sql Select regardless if they're used in JOIN's, UNION's or subqueries.
--sb--