Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning sets of records from a table with limited crit
Message
De
12/01/2004 18:12:19
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00866172
Message ID:
00866192
Vues:
25
That was the solution! Unfortunately my table has 500,000+ records and it takes almost 3 minutes to return the set. So, since that is not a viable option I'm just going to have to change the requirements. :-)

>Jay,
>
>This should work for you.
SELECT Name, ID FROM MyTable ;
>  WHERE id IN ( SELECT ID FROM MyTable WHERE Name == 'D')
>
>>I want to return a set of records where the ID is the same, but I don't know the value of the ID before the SQL runs. For example, from the following data I want C, D, E and F returned in the results because they all share the same ID (33333) as the D record:
>>
>>
>>Name  ID
>>
>>A     11111
>>B     22222
>>C     33333
>>D     33333
>>E     33333
>>F     33333
>>G     44444
>>
>>
>>
>>SELECT Name, ID FROM MyTable WHERE Name == 'D'
>>
>>
>>This obviously only returns the one D record, but I want the other 3 also. Any way to do it without doing multiple SQLs and a SCAN? Can the TOP clause be used somehow?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform