统计汇总问题
我有两张表,表1中有A B C D E F,表2中有A B C.其中表2中数据A 10,B 20,C 25,想生成一个新表3, 想在表3中实现表1和表2中共同的数据和不同的数据
表3
A 10
B 20
C 25
D 0
E 0
F 0
CREATE CURSOR TABA (NAMEA C(2)) FOR I= 1 TO 6 INSERT INTO TABA VALUES (CHR(64+I)) ENDFOR CREATE CURSOR TABB (NAMEA C(2),SJ I) INSERT INTO TABB VALUES ([A],10) INSERT INTO TABB VALUES ([B],20) INSERT INTO TABB VALUES ([C],25) SELECT A.NAMEA,NVL(B.SJ,0) SJ FROM TABA A FULL JOIN TABB B ON B.NAMEA==A.NAMEA INTO CURSOR TABC *--- 或者 SELECT A.NAMEA,NVL(B.SJ,0) SJ FROM TABA A LEFT JOIN TABB B ON B.NAMEA==A.NAMEA INTO CURSOR TABC BROWSE USE IN ([TABA]) USE IN ([TABB]) USE IN ([TABC])