USE 表1
** 取表1最后14行的H1、H2、H3
COPY TO ARRAY a1 FIELDS h1 FOR RECNO()>(RECCOUNT()-14)
COPY TO ARRAY a2 FIELDS h2 FOR RECNO()>(RECCOUNT()-14)
COPY TO ARRAY a3 FIELDS h3 FOR RECNO()>(RECCOUNT()-14)
DIMENSION a1[14],a2[14],a3[14]
** 统计表1最后14行H1、H2、H3的0-9数字出现的次数
DIMENSION aH1[10],aH2[10],aH3[10]
STORE 0 TO aH1,aH2,aH3
FOR i=1 TO 14
aH1[a1[i]+1] = aH1[a1[i]+1] + 1
aH2[a2[i]+1] = aH2[a2[i]+1] + 1
aH3[a3[i]+1] = aH3[a3[i]+1] + 1
ENDFOR
**表1最后14行 + 表2第n行,统计这15行的h1,h2,h3的0-9数字出现的次数,结果放到表2第n行。
USE 表2
SCAN
aH1[h1+1] = aH1[h1+1] + 1
aH2[h2+1] = aH2[h2+1] + 1
aH3[h3+1] = aH3[h3+1] + 1
GATHER FROM aH1 FIELDS h1_0,h1_1,h1_2,h1_3,h1_4,h1_5,h1_6,h1_7,h1_8,h1_9
GATHER FROM aH2 FIELDS h2_0,h2_1,h2_2,h2_3,h2_4,h2_5,h2_6,h2_7,h2_8,h2_9
GATHER FROM aH3 FIELDS h3_0,h3_1,h3_2,h3_3,h3_4,h3_5,h3_6,h3_7,h3_8,h3_9
aH1[h1+1] = aH1[h1+1] - 1
aH2[h2+1] = aH2[h2+1] - 1
aH3[h3+1] = aH3[h3+1] - 1
ENDSCAN
SELECT * FROM 表2