Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL: Distinct, Group By, or Exists?
Message
 
 
À
05/06/2003 10:09:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00796420
Message ID:
00796709
Vues:
14
>>I would do it in one of two ways (in the order of my personal preferences)
>>
SELECT PrimaryKey, DataItem ;
>>  FROM TableA ;
>>  WHERE PrimaryKey IN ( SELECT PrimaryKey FROM TableB WHERE Condition = .T.)
>>*
>>SELECT PrimaryKey, DataItem ;
>>  FROM TableA ta ;
>>  WHERE EXISTS ( SELECT * FROM TableB tb ;
>>        WHERE ta.PrimaryKey = tb.PrimaryKey AND tb.Condition = .T.)
>>
>
>Would either of these or the options in the other thread work if TableB were a pre-existing view instead of a SELECT?

The above two should work. I don't remember what other options were suggested.

>
>> You may want to take a look at recent discussion which one is faster. ?
>> Re: How to use select... where EXISTS ... ? Thread #793069.
>
>Still reading and digesting it. Thanks.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform