Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counter in a query 1

Status
Not open for further replies.

luceze

Programmer
Apr 26, 2001
842
0
0
US
Is there a way to make a counter in a query so that each record is numbered sequentially? 1,2,3,etc.

There is no need to store these values. It is used as a reference to export data to a comma-delimited file that I have to upload to another piece of software.

Thanks,

Eric
 
Transform your query in a maketable query, then add an autonumber field in the generated table.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
It's a drag on recourses, but if you have one unique field, sort on it, I think you could use something like this:

[tt]select t.field1, t.field2,....,
(select count(s.field1)
from mytable s
where s.field1<= t.field1) as mycount
from mytable t
order by field1[/tt]

Roy-Vidar
 
Thanks PHV and Roy.

Roy,you were right about it creaming your resources. But it worked!

Thanks again,

Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top