General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>I am have a problem with the following sql statement. I get an sql error as follows: Too many subqueries. Is there a limitation in VFP6 on the amount of subqueries in a select statement and what is it? Is there a work around for this problem beyond braking the select up? Thanks for your help!
>
>SELECT names.* ;
> FROM money32!names ;
> WHERE (names.id IN ;
> (SELECT names.id ;
> FROM money32!names ;
> JOIN money32!contrib ON names.id = contrib.id ;
...snip...
You can generally replace WHERE table1.yourfield IN (SELECT table2.yourfield FROM...) with ...FROM table1 INNER JOIN table2 ON table1.yourfield = table2.yourfield... It might also be faster. You already have a lot of JOINs, though.
You can often replace WHERE table1.yourfield NOT IN (SELECT table2.yourfield FROM....) with ...FROM table1 LEFT OUTER JOIN table2 ON table1.yourfield = table2.yourfield WHERE ISNULL(table2.yourfield)... I learned that from Mark McCasland, and I find that it is way faster. But it is less pure SQL and might not work in all cases.
Also, check your parentheses.
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