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

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

Post by TGluYSBNYW » Sun, 18 Feb 2007 22:50:00


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
 
 
 

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

Post by Rick Brand » Sun, 18 Feb 2007 23:30:13


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.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com