我正在通过使用左连接来总结 do while 循环的结果,但由于某些未知原因,它没有加入任何表,只是覆盖。什么是我看不见的?
DO WHILE counter < NbContracts
SELECT depot_nr as depot_nr;
WHERE rownum = counter FROM test3
test33(depot_nr, counter)
counter = counter + 1
ENDDO
CLOSE TABLES
PROCEDURE test33(depot_nr_in, NbofTimes)
USE bs_case alias bs
SELECT jaar as jaar,;
Psres4pcgb as &depot_nr_in;
WHERE Depot_nr = depot_nr_in FROM bs
COPY TO toJoin.dbf
DO CASE
CASE NbofTimes = 1
SELECT * FROM toJoin.dbf
COPY TO joining.dbf
CASE NbofTimes = NbContracts
SELECT * FROM bsP.tmp as one LEFT JOIN joining.dbf as aggregated;
ON (one.depot_nr = aggregated.depot_nr) into table final.dbf
CLOSE TABLES
ENDPROC
OTHERWISE
SELECT &depot_nr_in FROM toJoin.dbf as a LEFT JOIN joining.dbf as b;
ON a.jaar = b.jaar INTO TABLE final.dbf
CLOSE TABLES
USE final.dbf
COPY TO joining.dbf
ENDCASE
CLOSE TABLES
CLOSE DATABASES
ENDPROC
这些问题出现在 OTHERWISE 部分(我认为),并且由于另一个未知原因,我的 FoxPro 无法识别 CASE 结构(奖金问题,但优先级较低)。
关于我想要什么的小插图
test3.dbf
===================================
22
31
32
23
NbofTimes = 1
final.dbf
===================================
year 22
-----------------------------------
1 val1
2 val2
3 val3
... ...
80 val80
NbofTimes = 2
final.dbf
===================================
year 22 31
-----------------------------------
1 val1 val4
2 val2 val5
3 val3 val6
... ... ...
80 val80 val81
NbofTimes = 3
final.dbf
===================================
year 22 31 32
-----------------------------------
1 val1 val4 val7
2 val2 val5 val8
3 val3 val6 val9
... ... ... ...
80 val80 val81 val82
NbofTimes = 4
final.dbf
===================================
year 22 31 32 23
-----------------------------------
1 val1 val4 val7 val10
2 val2 val5 val8 val11
3 val3 val6 val9 val12
... ... ... ... ...
80 val80 val81 val82 val83
现在发生的事情是我的最终表格永远不会增长,它只包含最后一次迭代。帮助.....