I have sql="select aaa from table"
this return
AAA
BBB
CCC
DDD
I need
AAA 1
BBB 2
CCC 3
DDD 4
... .
ADDING A count +1
-
- Administrator
- Posts: 78466
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: ADDING A count +1
If the values of the aaa field are unique, you can use
sql = "SELECT aaa, (SELECT Count(*) FROM Table AS T WHERE T.aaa <= Table.aaa) AS Seq FROM Table"
sql = "SELECT aaa, (SELECT Count(*) FROM Table AS T WHERE T.aaa <= Table.aaa) AS Seq FROM Table"
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: ADDING A count +1
What happens when you get to Z ?
-
- Administrator
- Posts: 78466
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36