以下是引用lvkw391251在2013-5-2 08:09:53的发言:
表一:A B C D E ... 表二:A F G
1 2 2 3 3 1 5 7
1 3 4 2 4 3 4 5
1 2 3 4 2
2 3 2 2 3
3 4 3 2 1
3 5 3 2 3
合并后:A B C D E F G
1 2 2 3 3 5 7
1 3 4 2 4 5 7
1 2 3 4 2 5 7
2 3 2 2 3
3 4 3 2 1 4 5
3 5 3 2 3 4 5
求帮助,两个dbf文件,把表二合并到表一
原始数据表轻易不要动,可以生成新的查询表
程序代码:
CREATE CURSOR T1 (A N(1),B N(1),C N(1),D N(1),E N(1))
INSERT INTO T1 VALUES (1,2,2,3,3)
INSERT INTO T1 VALUES (1,3,4,2,4)
INSERT INTO T1 VALUES (1,2,3,4,2)
INSERT INTO T1 VALUES (2,3,2,2,3)
INSERT INTO T1 VALUES (3,4,3,2,1)
INSERT INTO T1 VALUES (3,5,3,2,3)
CREATE CURSOR T2 (A I,F N(1),G N(1))
INSERT INTO T2 VALUES (1,5,7)
INSERT INTO T2 VALUES (3,4,5)
SELECT A.A,A.B,A.C,A.D,A.E,NVL(B.F,0) F,NVL(B.G,0) G FROM T1 A LEFT JOIN T2 B ON A.A==B.A INTO CURSOR T3
BROWSE