SELECT DISTINCT 编号,编号 bh ,OCCURS(',',编号) cs FROM bA INTO CURSOR tmp READWRITE ORDER BY cs desc SELECT tmp GO top ics=cs FOR i= 1 TO 1 SELECT 编号,SUBSTR(bh,AT(',',bh,i)+1) bh FROM tmp INTO CURSOR mp WHERE cs>=i wjm=DBF('mp') SELECT tmp APPEND FROM &wjm. ENDFOR REPLACE bh WITH LEFT(bh,AT(',',bh)-1) FOR AT(',',bh) >0 SELECT a.编号 ,avg() FROM tmp a,bb b WHERE b.编号=a.bh GROUP BY a.编号 INTO dbf tjjg