4

For example, assuming that table A is in database example and table B is in database postgres, how to perform the following query on the two tables?:

SELECT
 A.date,
 A.name,
 B.date,
 B.name
FROM A
INNER JOIN B ON A.name = B.name;

enter image description here

4
  • Your previous answer was correct, the linked question is about two databases which are located on different postgres servers, whereas your answer was for two databases in the same postgres server Commented Nov 14, 2018 at 2:48
  • Yes syntax correct but it cannot produce because foreign key cannot connect to other database.. Postgresql cannot do Query joining on Across Database.. Commented Nov 14, 2018 at 2:54
  • @Greg: it doesn't matter if the database are on the same server or different servers. In both cases you would use a foreign data wrapper: stackoverflow.com/a/36904631 Commented Nov 14, 2018 at 6:35
  • allow me to add useful references for any reader: stackoverflow.com/questions/4678862/… and stackoverflow.com/questions/29900748/… Commented Mar 14, 2019 at 17:36

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.