CLOSE DATABASES
USE 表1 IN 0
INDEX ON 班级+姓名 TAG BJXM
USE 表2 IN 0
SELECT 表2
SET RELATION TO 班级+姓名 INTO 表1
SCAN IF FOUND("表1") REPLACE 成绩2 WITH 表2.成绩2 IN 表1 ELSE INSERT INTO 表1 (姓名,班级,成绩2) VALUES (表2.姓名,表2.班级,表2.成绩2) ENDIF
ENDSCAN
SET RELATION TO
SELECT 表1
SET ORDER TO
BROWSE
SELECT * FROM 表1 INTO CURSOR tmp READWRITE
INSERT INTO tmp (姓名,班级) SELECT 姓名,班级 FROM 表2; WHERE 姓名+班级 NOT in (SELECT 姓名+班级 FROM tmp)
UPDATE tmp SET tmp.成绩2=表2.成绩2 from 表2 WHERE tmp.姓名=表2.姓名 AND tmp.班级=表2.班级
SELECT * FROM tmp
CLOSE DATABASES
USE 表1 IN 0
INDEX ON 班级+姓名 TAG BJXM
USE 表2 IN 0
SELECT 表2
SET RELATION TO 班级+姓名 INTO 表1
SCAN IF FOUND("表1") REPLACE 成绩2 WITH 表2.成绩2 IN 表1 ELSE INSERT INTO 表1 (姓名,班级,成绩2) VALUES (表2.姓名,表2.班级,表2.成绩2) ENDIF
ENDSCAN
SET RELATION TO
SELECT 表1
SET ORDER TO
BROWSE