Row Number

KLLW

New member
Local time
Today, 12:26
Joined
Aug 14, 2018
Messages
3
I have a table that will be sorted descending by a number field. I want to apply another column that will contain sequential number starting with 1. Something like this:


DATA_COL _number
25 1
20 2

10 3

2 4

1 5


I have tried DCOUNT but am having a hard time with syntax.
 
I got it to work.
 
If your table is Table1 with the column to be sorted DATA_COL _number, then if you join it to itself

You can have a query

Code:
Select Table1.DATA_COL _number, count(*) as rank
from Table1, Table1 as T1
where
T1.DATA_COL _number>=Table1.DATA_COL _number
Group by Table1.DATA_COL _number
order by Table1.DATA_COL _number DESC

This gives the result you want.
 

Users who are viewing this thread

Back
Top Bottom