"merge" two tables -from different databases- together?
In MS SQL there is a MERGE statement that meets your requirements.
PostgreSQL has the same.
Read more: https://www.postgresql.org/message-id/attachment/23520/sql-merge.html
It allows full control about conditions when to add a row, update a row or delete a row in the target db. I have frequently used it. But it is not a high performance operation if used with a lot of rows.
Of course you need to take care for a direct connection between the servers running the databases.
Sample:
MERGE CustomerAccount CA
USING (SELECT CustomerId, TransactionValue, 
   FROM Transactions
   WHERE TransactionId &gt; 35345678) AS T
ON T.CustomerId = CA.CustomerId
WHEN MATCHED 
  UPDATE SET Balance = Balance - TransactionValue
WHEN NOT MATCHED
  INSERT (CustomerId, Balance)
  VALUES (T.CustomerId, T.TransactionValue)
;