Selecting data from multiple databases using a single select statement

i need help, i want to select two tables from two different databases using one select statement. like:
$sql = "SELECT attribuleA, attribuleB, attribuleC,
FROM database1.tableA, database2.tableB
WHERE tableA.id = tableB.id ";
How do I do this in PHP?
how do i create connection for multiple databases in the same server?

The simplest is to add an alias name for each database.table identifier, then use that alias as a prefix for each column identifier.

Why is the data in separate databases?

I’m developing a central application system. So, I have a system database that contain all users details, and an integrated database which is the result of different databases integrated into 1

Hmm, not sounding right.

Just like you would do other queries - it’s just an SQL statement.

$pdofoo = new PDO...;
$pdobar = new PDO...;
Sponsor our Newsletter | Privacy Policy | Terms of Service