我很难判断特定连接的商业意义,但我相信从实现的角度来看,最简单的方法是在 db2 中创建一个临时表,它是 db1.tableA 的副本。例子:
<connection id="db1" ....>
<connection id="db2" ....>
<script connection-id="db2">
CREATE TABLE tableAFromDb1 (
....
);
</script>
<query connection-id="db1">
<!-- Copy all rows from db1 to db2 -->
SELECT columnA, columnB FROM db1.tableA
<script connection-id="db2">
INSERT INTO db2.tableAFromDb1 (columnA, columnB) VALUES (?1, ?2);
<script>
</query>
<!-- Produce the outer join if necessary or directly manipulate the tableAFromDb1 dataset -- >
<query connection-id="db2">
SELECT columnA, columnA
FROM tableA LEFT OUTER JOIN
tableAFromDb1 ON tableAFromDb1.columnB = tableA.columnB
<script>
TODO Insert the result somewhere
</script>
</query>