Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL SubQueries!
Message
From
05/06/2001 14:27:09
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00515297
Message ID:
00515305
Views:
13
>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 ;
> JOIN money32!bluebook ON contrib.source_key = bluebook.key ;
> JOIN money32!fund ON bluebook.fund_key = fund.key ;
> JOIN money32!letter ON bluebook.letter_key = letter.key ;
> JOIN money32!summary ON names.id = summary.id ;
> JOIN money32!memdata ON summary.mem_key = memdata.key ;
> JOIN money32!nameinfo ON names.id = nameinfo.id ;
> JOIN money32!pledge ON names.id = pledge.id ;
> WHERE pledge.pledgebal > 1 ;
> AND summary.hpcamt > 5 ;
> AND UPPER(letter.letter) LIKE "E%" ;
> AND UPPER(bluebook.source) LIKE "A%" ;
> AND UPPER(fund.fund) LIKE "D%" ;
> AND summary.ytdamt > 5 ;
> AND UPPER(memdata.memdesc) LIKE "C%" ;
> AND UPPER(nameinfo.email) <> SPACE(LEN(UPPER(nameinfo.email))) ) ) ;
> AND (names.deleteflag # 1) ;
> AND PADR(names.id,LEN(MainQuery.id)," ") NOT IN (SELECT id FROM MainQuery) ;
> GROUP BY names.id ;
> INTO CURSOR SQL_Query

I found once that Fox doesn't like to have folded IN/NOT IN subqueries, and you have two.
Whatever the case is, it's always efficient way to break complicated SQL to few simpler ones.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform