Two different databases in same query (PHP / MySQL)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nmotion
Forum Commoner
Posts: 32
Joined: Wed Jan 22, 2003 6:53 am

Two different databases in same query (PHP / MySQL)

Post by nmotion »

I want to do the following:

Code: Select all

SELECT table1.cell1, table2.cell1 FROM table1, table2 WHERE table1.cell2 = table2.cell2
My problem is that table1 is in one database and table2 is in another. How do I make the connection so this works?

I use PHP and MySQL

Thanks,
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

You'll have to use simultaneous connections and connect to each database seperately.
Joins will only work accross tables within the same db.
Embed the second query within the result loop of the first query if need be.
Post Reply