Extraction of Records

wpc_por
09-27-2000, 03:08 AM
I have a list of about 2000 items (extracted from database)
and for each of these item I would like to extract the
records for the 30 latest transactions made.
Now I am doing it this way:

1. Run query to extract items wanted
2. Write items into file
3. Close query and database

For i = 1 to No_of_items
1. Read item from item list (in above data file)
2. Add the item to my SQL in the WHERE section and extract data
3. Read/Write information for every record extracted
next i

Unfortunately this method is taking Ages (more than
4 hours to complete; tried using the ADO and Access).
Is there anyway that i can use one SQL to complete the
data extraction for all the (2000x30) records that I need?
I'm no expert in SQL!! Or maybe another way to get it done
faster.....
Thank you in advance for any guidance provided.

whelanp
09-27-2000, 08:25 AM
I assume you have 2 tables??

If so it sounds like a simple join is all you want.

Post some table details and I'll give you some examples.

Valkyrie
09-27-2000, 12:59 PM
Change your initial SQL statement from <font color=blue>SELECT .....</font color=blue> to <font color=blue>SELECT TOP 30 ....</font color=blue>. This will return on the first 300 records. You can change which records by changing the ORDER BY clause so that you can get the first or last 30 records.

This should save you GOBS of time.

Cheers.


Quote of the moment....
"Ability has nothing to do with opportunity." - Napoleon Bonaparte

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum