如何自动填充排序数值?
姓名 代码 数值A 10
A 11
A 10
A 9
B 6
B 4
B 9
B 10
C 11
C 16
C 21
C 22
用什么命令自动按姓名,填充代码栏从01-04
程序代码:Create Cursor Tt (A1 C(1),A2 N(2),A3 N(2))
Insert Into Tt (A1) Values ("a")
Insert Into Tt (A1) Values ("a")
Insert Into Tt (A1) Values ("c")
Insert Into Tt (A1) Values ("b")
Insert Into Tt (A1) Values ("d")
Insert Into Tt (A1) Values ("c")
Insert Into Tt (A1) Values ("b")
Insert Into Tt (A1) Values ("b")
Insert Into Tt (A1) Values ("b")
Replace All A2 With Recno()
Update Tt Set Tt.A3=(Select Count(*)+1 From Tt B Where Tt.A2<B.A2 And Tt.A1=B.A1) FROM Tt
Select * From Tt Order By A1,A3
**********************************************************
* 方法二
Create Cursor Tt (A1 C(1),A2 N(1))
Insert Into Tt (A1) Values ("a")
Insert Into Tt (A1) Values ("a")
Insert Into Tt (A1) Values ("c")
Insert Into Tt (A1) Values ("b")
Insert Into Tt (A1) Values ("d")
Insert Into Tt (A1) Values ("c")
Insert Into Tt (A1) Values ("b")
Insert Into Tt (A1) Values ("b")
Insert Into Tt (A1) Values ("b")
Select A1,Count(*) nJs From Tt Group By A1 Into Cursor Temp
Scan
Select Tt
lnI=1
Scan For A1==Temp.A1 And lnI<=Temp.nJs
Replace A2 With lnI
lnI=lnI+1
EndScan
EndScan
Select * From Tt Order By A1