交叉表向导
CREATE CURSOR tt (学号 C(4), 课程 C(10), 成绩 N(3))
INSERT INTO tt VALUES ("2001", "化学", 80)
INSERT INTO tt VALUES ("2001", "物理", 85)
INSERT INTO tt VALUES ("2002", "化学", 90)
INSERT INTO tt VALUES ("2002", "物理", 95)
INSERT INTO tt VALUES ("2002", "政治", 100)
SELECT DISTINCT 课程 FROM tt INTO CURSOR tmp
cmd = "CREATE CURSOR tj (学号 C(4)"
SCAN
cmd = cmd + ","+ALLTRIM(tmp.课程)+" N(3)"
ENDSCAN
cmd = cmd + ")"
EXECSCRIPT(cmd)
SELECT DISTINCT 学号 FROM tt INTO CURSOR tmp
SELECT tj
APPEND FROM DBF("tmp")
INDEX on 学号 TAG 学号
SELECT tt
SET RELATION TO 学号 INTO "tj"
SCAN
REPLACE ("tj."+ALLTRIM(tt.课程)) WITH tt.成绩
ENDSCAN
SET RELATION TO
SELECT tj
BROWSE
[此贴子已经被作者于2017-8-27 10:24编辑过]