Row Number (1 Viewer)

KLLW

New member
Local time
Today, 03:32
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.
 

KLLW

New member
Local time
Today, 03:32
Joined
Aug 14, 2018
Messages
3
I got it to work.
 

Yev18

New member
Local time
Today, 09:32
Joined
Aug 17, 2018
Messages
4
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

Top Bottom