Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WHERE clause with JOIN syntax
Message
De
23/12/2005 09:19:26
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01080471
Message ID:
01080481
Vues:
18
>>>I seem to keep getting syntax errors if I try to use WHERE and JOIN ON in the same SQL query. Can you use a where clause in an SQL statement that is written as a JOIN, or do all the "WHERE" conditions for both tables have to be in the ON clause?
>>>
>>>Does anybody have a "personal favorite" suggestion for an advanced SQL tutorial / reference?
>>>
>>>Thanks very much.
>>
>>I routinely use JOIN ON syntax to relate tables with a following WHERE clause to filter the results using fields from one or more of the joined tables.
>>
>>The best thing I've seen is "Taming Visual FoxPro's SQL" by Tamar Granor with Della Martin. It's available as an Ebook from Henzenwerke Publishing, http://www.hentzenwerke.com/.
>>
>>Regards,
>
>Thanks very much. I wonder if it's the positioning I'm doing wrong. A statement like:
>
select a.field1, a.field2, b.fieldfromb ;
>where a.field1="X" ;
>from table1 a ;
>inner join table2 b on b.somefield=a.somefield
>gives me an error, but if I change the statement to
>
select a.field1, a.field2, b.fieldfromb ;
>from table1 a ;
>inner join table2 b on b.somefield=a.somefield and a.field1="X"
then the error goes away. ????

JOIN is used to specify the realtionship between the files, WHERE is used to specify which records you want. So JOIN is like SET RELATION, WHERE is like SET FILTER.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform