Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning sets of records from a table with limited crit
Message
From
12/01/2004 18:12:19
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00866172
Message ID:
00866192
Views:
23
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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform