numbering records in a query

G

Guest

Hello all,
I need count records in a query for every type of Field in a table. Data
example:

ID Field
1 aaaaa
2 aaaaa
3 aaaaa
4 bbbbb
5 bbbbb
6 ccccc

and I need something like this:

ID Field Counter
1 aaaaa 1
2 aaaaa 2
3 aaaaa 3
4 bbbbb 1
5 bbbbb 2
6 ccccc 1

any idea ? Please help me......
Thanks in advance...
 
M

Michel Walsh

Hi,


SELECT a.ID, a.Field, COUNT(*)
FROM myTable as a INNER JOIN myTable As b
ON a.Field=b.Field AND a.ID>=b.ID
GROUP BY a.ID, a.Field



Hoping it may help,
Vanderghast, Access MVP
 
G

Guest

hi Michel,
it doesn't work.
Can you send me please a small example? My e-mail is (e-mail address removed)

thanks

Michel Walsh píše:
 

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