how to number records in access query

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

Guest

I have a select query that returns a number of fields and I would like there
to be a column that will number each record in the results sequentially from
number one. I am not too good with SQL so will need the instructions using
the design grid.
 
Dear Marilyn:

If I can provide you with the SQL to do this, then you can just paste it in.
You can then go to the design grid and see what it looks like there.

On the other hand, I cannot send you the query in Design View so you can
just paste it in. Text is the natural domain of a newsgroup.

So, please send me the SQL View text of what you have so far. It needs to
be explicitly sorted in the order you desire for the numbering (usually
called ranking). I can add the ranking column and send that back. You can
paste that in and then see the Design View it produces. Pretty simple,
really.

Sound OK?

Tom Ellison
 
Marilyn said:
I have a select query that returns a number of fields and I would like there
to be a column that will number each record in the results sequentially from
number one. I am not too good with SQL so will need the instructions using
the design grid.

Hi Marilyn

Here the general solution (one of them).

Add one field to the query:
MyCounter: (Select Count (*) FROM [products] as Temp WHERE [Temp].[Id] <
[products].[Id])+1

Here for a table "Products". ID must bey a keyfield no duplicates. Also
possibel to use the Dcount funktion.

Regs

Peter
 
Back
Top