Query Time Minimisation Though Loops

select dates,

sum(payment)

from table
where dates > ‘25-Feb-12’

and dates < ‘05-Mar-12’

group by dates;

Many thanks
Robert

If i run the below query for 1 day it takes 1 second. If I run it for 10 days it takes 30 seconds. So it would be more efficient for me to run the query for 1 day ten times and combine the results. Is this possible through the use of a loop?

The table has three fields: TRANSACTIONID, DATES, PAYMENT
(I have read-only access to the database.)

This is possible if you insert the data into a table. You can use the Toad Sample Database (access) or if using TDA Pro use local storage. Each time you do the query you append the data in the table for querying at a later date.

All other methods, such as exporting to the same excel file or appending results to Tef file, always add a new worksheet or result tab and do not append the data in the same results.

Debbie