I have a problem with join 2 database. First.. I tried use this query:
SELECT *
FROM my_db1.table1 tb1
LEFT JOIN my_db2.table2 tb2 ON tb2.code = tb1.code
I get the following error:
schema "my_db2" does not exist.
So I tried:
SELECT *
FROM dblink('my_db2', 'SELECT * FROM table2')
But it still doesn't work.
What should I do, to select from two tables that are in different databases?