RECORD_NUMBER()

  • Thread starter Thread starter jon
  • Start date Start date
J

jon

Hi,
I need to create a function that I can use in a query to calculate the
record number for a line.

So if my query has 5 lines, I need the column to show 1 in the first line,
and 5 in the last.

I was hoping I can use a function somehow, but I'm not sure how to do it.

Does anyone have any suggestions ?

Thanks

Jon
 
This query is viewable only in SQL view. Prim is your primary key field.

SELECT (COUNT(*)) AS Row, a.Column1, a.Column2
FROM [YourTable-4] AS a LEFT JOIN [YourTable-4] AS b ON a.Prim>=b.Prim
GROUP BY a.Column1, a.Column2;
 

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

Back
Top