Page 1 of 1

Two different databases in same query (PHP / MySQL)

Posted: Tue Jul 22, 2003 7:42 am
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,

Posted: Tue Jul 22, 2003 9:59 am
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.