每班都是这样。排序,横排。出各科在6科中的位次。
CLOSE TABLES all USE 表1 cfldlist='语文,数学,英语,物理,化学,生物' n=ALINES(afld,cfldlist,1+4,',') DIMENSION awc(n,2) SCAN FOR i=1 TO n awc(m.i,1)=afld(m.i)+"位次" cmc=afld(m.i)+"名次" awc(m.i,2)=&cmc ENDFOR =ASORT(awc,2) k=1 pre=awc(1,2) FOR i=1 TO n if awc(i,2)#pre k=i pre=awc(i,2) endif replace &awc(i,1) WITH k endfor ENDSCAN
[此贴子已经被作者于2020-6-11 11:34编辑过]
SELECT * FROM 表1 INTO CURSOR tt READWRITE SCAN SCATTER FIELDS EXCEPT 班级 TO azd nRows = ALEN(azd) / 2 FOR i = 1 TO nRows azd[i * 2] = FIELD(i * 2 + 1) ENDFOR DIMENSION azd[nRows, 2] ASORT[azd, 1] nwc = 1 nmc = azd[1,1] FOR i = 1 TO nRows IF azd[i, 1] != nmc nwc = i nmc = azd[i,1] ENDIF REPLACE (azd[i, 2]) WITH nwc ENDFOR ENDSCAN BROWSE