select AA.编号,AA.型号,AA.数据1,BB.数据2 ; from ; (select A表.编号,A表.型号,B表.数据1 from A表 Left Join B表 ON alltrim(A表.编号)==alltrim(B表.编号)) AA ; Left Join ; (select A表.编号,A表.型号,C表.数据2 from A表 Left Join C表 ON alltrim(A表.编号)==alltrim(C表.编号)) BB ; ON alltrim(AA.编号)==alltrim(BB.编号)
[此贴子已经被作者于2021-3-7 06:43编辑过]
* VFP9 代码 CREATE CURSOR t1 (编号 c(10), 型号 c(22)) INSERT INTO t1 VALUES ("01", "a") INSERT INTO t1 VALUES ("02", "b") INSERT INTO t1 VALUES ("03", "c") INSERT INTO t1 VALUES ("04", "d") CREATE CURSOR t2 (编号 c(10), 数据1 n(10)) INSERT INTO t2 VALUES ("02", 2) INSERT INTO t2 VALUES ("04", 4) CREATE CURSOR t3 (编号 c(10), 数据2 n(10)) INSERT INTO t3 VALUES ("01", 1) INSERT INTO t3 VALUES ("03", 3) INSERT INTO t3 VALUES ("04", 4) CREATE CURSOR t4 (编号 c(10), 型号 c(22), 数据1 n(10), 数据2 n(10)) INSERT INTO t4 (编号, 型号) SELECT 编号, 型号 FROM t1 INDEX on 编号 TAG bh lc = "t2,t3" ALINES(la, lc, ",") FOR lnj = 1 TO ALEN(la, 1) SELECT (la[lnj]) SET RELATION TO 编号 INTO t4 SCAN REPLACE ("数据" + STR(lnj, 1)) WITH EVALUATE(la[lnj] + ".数据" + STR(lnj, 1)) IN t4 ENDSCAN ENDFOR SELECT t4 SET ORDER TO BROWSE