Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL learner ...
Message
From
27/03/2002 04:37:27
 
 
To
27/03/2002 04:12:49
Denis Filer
University of Oxford
United Kingdom
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00637683
Message ID:
00637688
Views:
20
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform