how to assign a sequential row numbers for each row in a query in

G

Guest

I have a large database with some complex queries.
I need to have a new query based on the others. And I need to have a running
sum column. My problem is that I have several rows for every date, so I 'need
to have a sequencial column.

how can I assign a sequential row numbers for each row in a query?

Then I can have muy running sum based on this seq num.

Thanks lot!!

Lina
 
R

Rick Brandt

Lina said:
I have a large database with some complex queries.
I need to have a new query based on the others. And I need to have a
running sum column. My problem is that I have several rows for every
date, so I 'need to have a sequencial column.

how can I assign a sequential row numbers for each row in a query?

Then I can have muy running sum based on this seq num.

Is it *really* necessary to have this in the query or would having it in a
report be satisfactory? While this can be done in a query it is complex and
slow. In a report it is a snap and has no performance penalty at all.

The reason is that queries are based on "Sets" of data. There really is no
concept of "the record before this one" or "the record after this one" like
there is in a spreadsheet. This means that you have to run a sub-query for
every row in the main query which is why performance can be really bad.

A report in contrast is rendered sequentially so the ability to do running sums
is built in and easy to do.
 
G

Guest

Thanks a lot, you are right!

Rick Brandt said:
Is it *really* necessary to have this in the query or would having it in a
report be satisfactory? While this can be done in a query it is complex and
slow. In a report it is a snap and has no performance penalty at all.

The reason is that queries are based on "Sets" of data. There really is no
concept of "the record before this one" or "the record after this one" like
there is in a spreadsheet. This means that you have to run a sub-query for
every row in the main query which is why performance can be really bad.

A report in contrast is rendered sequentially so the ability to do running sums
is built in and easy to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top