-1
Guys, I’m having a problem.
Currently I have two databases and two tables (1 table in each database) that need to be connected in one query
only. It would be a JOIN
in other words, but I’m not getting to understand how I do it in another database.
Connection between banks has the same user and password, but has different calls.
Banco Financeiro = $financeiro->query();
Banco Clientes/Site = $site->query();
I tried to apply a JOIN and some other results I found on Google but I was not successful when I need to access another bank.
We currently have the field cliente
in the table of financeiro
and the countryside chns
on the table of clientes
, where the chns
is the unique client code that is used throughout the rest of the system for identification.
Wanted SQL in this style (if possible) that I already use in connections within the same database:
$financeiro->query("SELECT * FROM financeiro AS FA JOIN clientes AS CL ON FA.cliente = CL.chns ORDER BY CL.nome ASC")
;
The connections are all made in PDO
.
What was the query what you tried to do but it didn’t work? Edit your question and add it.
– Luiz Felipe
Databases are on the same server or on different servers?
– Augusto Vasques