Query and record counter

P

P Stubbin

I wish to creat a query that retrieves records from a
table but include as an additional field the actual
record number identified with each group of fields
retrieved.

ie. e.g., Field1, Field2, and recordnumber retrieved in
the final query

any ideas how?
 
C

Chris2

P Stubbin said:
I wish to creat a query that retrieves records from a
table but include as an additional field the actual
record number identified with each group of fields
retrieved.

ie. e.g., Field1, Field2, and recordnumber retrieved in
the final query

any ideas how?

P Stubbin,

CREATE TABLE YourTable
(YourTableID AUTOINCREMENT
,Field1 LONG
,Field2 LONG
,CONSTRAINT pk_YourTable PRIMARY KEY (YourTableID)
)

Sample Data
YourTableID Field1 Field2
1 2 1
2 2 10
3 3 1
4 3 10
5 3 100
6 4 1
7 4 100
8 4 1000
9 4 10000
10 5 1

If I assume correctly, when you SUM Field2, and GROUP BY on Field1,
you want MS Access to return YourTableID?

If that's what you want, then no, Access can't do that. Access has no
idea which YourTableID to return (even if there is only one value for
Field1, like 5, for YourTableID 10).

If that wasn't what you wanted, write back and let me know.


Sincerely,

Chris O.
 

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