LOCAL col1 LOCAL ii DIMENSION arr1[1] CLOSE TABLES ALL USE zbts IN 0 EXCLUSIVE USE zbb IN 0 SHARED CREATE CURSOR tmphz (xm C(20) NOT NULL , ts i NOT null) AFIELDS(arr1 ,'zbb') ii = 0 FOR ii = 1 TO ALEN(arr1,1) col1 = arr1[ii,1] INSERT INTO tmphz (xm,ts) ; SELECT &col1 as xm ,1 as ts FROM zbb ENDFOR INSERT INTO zbts (姓名, 值班天数) ; SELECT xm as 姓名,SUM(ts) as 值班天数 FROM tmphz GROUP BY xm USE IN tmphz