Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL SubQueries!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00515297
Message ID:
00515326
Vues:
16
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform