Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a complex query
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Divers
Thread ID:
00980679
Message ID:
00980696
Vues:
52
Colin

Not sure whether the following would work, or fail if just one criterion is not fulfilled, but you can give it a bash:
Select .... from ... ;
where Town = lcInputTown and not EMPTY( lcInputTown) ;
  and Country = lcInputC and not EMPTY( lcInputC ) ;
  and ZipCode = lcInputZip and not EMPTY( lcInputZip ) ;
  and ...
  into cursor PostmansSock NOFILTER
or:
Select .... from ... ;
where ( Town = lcInputTown or EMPTY( lcInputTown)) ;
  and ( Country = lcInputC or EMPTY( lcInputC )) ;
  and ( ZipCode = lcInputZip or EMPTY( lcInputZip )) ;
  and (...)...
  into cursor PostmansSock NOFILTER
Note that the NOFILTER clause enables the resultant cursor to be used in your next query, as in

Select ... from PostmansSock ...

If this is connected to your previous question re: "Query is read-only", then, in the query builder, you can open the SQL window and still select and copy the SQL, to get the bulk/essence of it, and paste it into your code, to do the above enhancements.

HTH

Terry



>Hi
>
>I am trying to work out the code for the following
>
>I have 12 query fields - any or all may contain values - I only want SQL to run the query on those fields where the query field is non blank
>
>eg Town = New York Country = USA zipcode (blank)
>
>The query would only work on town and country since the zipcode field is blank
>
>Alternatively I might have to run a number of queries one after using the results from query 1 as the source data for query 2 - is there any way I can do this?
>
>Thanks
>
>Colin
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform