line numbers and sums

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to put a line number in each line of the query, for example row1=1,
row2=2, etc.
How do I do it?

I want to put a running sum in a column that adds values from the ajoining
column:

column1 columm2
1 1
3 4
7 11

How do I do it.
 
david white said:
I want to put a line number in each line of the query, for example row1=1,
row2=2, etc.
How do I do it?

I want to put a running sum in a column that adds values from the ajoining
column:

column1 columm2
1 1
3 4
7 11


Are you sure you really need this n the query? As Rick
says, its much simpler in a report.

If you must have these calculations in the query, then add
calculated fields that use a subquery.

SeqNum: (SELECT Count(*) FROM table As X WHERE X.key <=
table.Key)

RunSum: (SELECT Sum(field1) FROM table As X WHERE X.key <=
table.Key)

the Key field is the unique field that you're using to
establish the order of the line number or running sum.
 
Back
Top