Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL statement works, but not from form's data session
Message
From
26/03/2000 01:04:16
 
 
To
25/03/2000 08:57:32
Chris Crachiolo
Blackmoor Associates Incorporated
New York City, New York, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00350306
Message ID:
00350495
Views:
32
>>
>>How about posting the query?
>
>Here it is:
>
>SELECT PROPERT3.BORO, PROPERT3.BLOCK, PROPERT3.LOT, PROPERT3.TAXYEAR,;
> CERTFILE, certothr, REQUEST,AUDITOR, COMPLETE, CONFREQ1, CORPCOUN, CONFDATE,;
> RESULT, RJIFILED, NOTES FROM PROPERT3 LEFT OUTER JOIN CONFSTAT ON ;
> PROPERT3.BORO+STR(PROPERT3.BLOCK,6,0)+STR(PROPERT3.LOT,6,0)+;
> STR(PROPERT3.TAXYEAR,4,0)= CONFSTAT.BORO+STR(CONFSTAT.BLOCK,6,0);
> +STR(CONFSTAT.LOT,6,0)+STR(CONFSTAT.TAXYEAR,4,0) INTO CURSOR TMP_CURS;
> WHERE (CERTOTHR = 'Y' OR CERTFILE <> {}) ORDER BY PROPERT3.BORO,;
> PROPERT3.BLOCK, PROPERT3.LOT, PROPERT3.TAXYEAR, CONFDATE

I'll try to reformat this in the style I normally use:
SELECT ;
A.Boro, ;
A.Block, ;
A.Lot, ;
A.TaxYear, ;
B.CertFile, ;
B.CertOthr, ;
B.Request, ;
B.Auditor, ;
B.Complete, ;
B.ConfReq1, ;
B.CorpCoun, ;
B.ConfDate, ;
B.Result, ;
B.RJIFiled, ;
B.Notes ;
FROM Propert3 A ;
LEFT OUTER JOIN ConfStat B ;
ON A.Boro + STR(A.Block, 6, 0) + STR(A.Lot, 6, 0) + STR(A.TaxYear, 4, 0) <b>==</b> ;
B.Boro + STR(B.Block, 6, 0) + STR(B.Lot, 6, 0) + STR(B.TaxYear, 4, 0) ;
WHERE (B.CertOthr <b>==</b> "Y" OR CertFile <> {}) ;
INTO CURSOR Tmp_Curs ;
ORDER BY A.Boro, A.Block, A.Lot, A.TaxYear, B.ConfDate
For readability I've used table aliases. Mixed case is a lot easier to read; personally I use upper case to distinguish VFP commands/functions etc.

Perhaps most importantly, wherever you're doing a string comparison I've replaced "=" with "==" (bold font). This forces an exact match. Also, if there's a chance that some strings may be upper case and others mixed or lower case, you should use UPPER() or LOWER() to force the comparison strings to be the same case.

Having said all that, it still doesn't help you with your problem. Are you working against tables on a local HD or against a server? If the latter, what is the network type, and what client software does your machine use to connect to the network?

Also, although the source tables may be small, the result set may not be... how many rows is the query returning when it is successful? You might find you get a lot fewer with exact matching and/or using UPPER() etc.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform