How to make an INNER JOIN between two different banks on the same server in MYSQL?

2

I would like to make a INNER JOIN between two distinct tables that are on the same server. Was it something like that?

INNER JOIN BANCOA.tabelaA.colunaA ON BANCOA.tabelaA.colunaA = BANCOB.tabelaB.colunaB

Remembering that I'm doing this in MYSQL and the tables are on the same server.

    
asked by anonymous 13.10.2017 / 16:29

2 answers

2

The only thing I had to do was remove the first **colunaA** from the query, simple example:

SELECT * 
FROM banco1.tabela1
INNER JOIN banco2.tabela1 ON banco1.tabela1.campo1=banco2.tabela1.campo1

Just need to make select earlier to work fine.

  

More information on INNER JOIN .

If you want more information about select to tables on different servers see here at PT at EN .

    
13.10.2017 / 16:32
3

Considering that the bank user has the appropriate permissions, yes.

As can be seen in this topic , considering a base A and a base B, one can do

SELECT <...> FROM A.tabelaA TA JOIN B.tabelaB TB ON TA.colunaA = TB.colunaB;
    
13.10.2017 / 16:34