Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subquery, two key fields
Message
De
04/04/2007 17:18:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01211882
Message ID:
01212218
Vues:
15
Thanks.

I am assuming that EXISTS will do a separate lookup for each record, and will therefore be slow with large tables. Any comments about this assumption?

>You can use EXISTS query or concatenate fields
>... where EXISTS (select * from Table2 WHERE KeyField = Table1.KeyField AND KeyField2 = Table1.KeyField2 )
>
>... where KeyField1 + KeyField2 in (select KeyField + KeyField2 from Table2)
>
>
>
>>Is it possible to do I do a subquery with two key fields (or join fields)?
>>
>>For example, with a single keyfield, I would write:
>>
>>
>>select * from Table1;
>>  where KeyField in (select KeyField from Table2)
>>
>>
>>With two fields, I would need something like the following:
>>
>>
>>... where KeyField1, KeyField2 in (select KeyField, KeyField2 from Table2)
>>
>>
>>But I am not sure whether this is possible at all, and if it is, what the syntax would be.
>>
>>In the meantime, I am using JOIN syntax, which works OK... but I am still curious if the subquery with two join fields is possible.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform