Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL learner ...
Message
De
27/03/2002 04:37:27
 
 
À
27/03/2002 04:12:49
Denis Filer
University of Oxford
Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00637683
Message ID:
00637688
Vues:
19
This message has been marked as the solution to the initial question of the thread.
Denis,

As you have discovered, the SQL command must specify the relations you desire, as well as any filtering. Unless you are using an early version of FoxPro, you can use an INNER JOIN clause:
SELECT * FROM sp INTO TABLE (cMytemptab) ;
  INNER JOIN splink ON sp.spcode = splink.spcode ;
  WHERE &customwhere
Alternatively, you can put it all in the WHERE and FROM clauses, although the syntax above is more standard and more portable to other database systems. In this case, an INNER JOIN is implied:
SELECT sp.* FROM sp, splink INTO TABLE (cMytemptab) ;
  WHERE sp.spcode = splink.spcode ;
  AND &customwhere
>I am converting all my home-written queries into SQL. I am learning that I have to think differently! e.g. SQL does not respect normal filters. I also realise that my table relations are ignored in where clauses.
>
>1. The main table alias SP is related to a table with alias SPLINK on a
>field SPCODE.
>
>2. My where clause (&customwhere)is:
>sp.taxstat = 'ACC' and splink.habit = 'TR'
>
>3. My SQL select clause is:
>SELECT * FROM SP INTO TABLE (cMytemptab) WHERE &customwhere
>... does not work.
>
>Do I have to use a join statement?
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform