RECORD_NUMBER()

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
 
K

KARL DEWEY

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;
 
Top