Php/Mysql nested query using 2 dbs

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
freefall
Forum Commoner
Posts: 48
Joined: Sun Jun 18, 2006 3:55 am

Php/Mysql nested query using 2 dbs

Post by freefall »

I have this line here:

"SELECT alias FROM $grouptable WHERE id IN (SELECT aliasid FROM $grouproletable WHERE roleid ='$id')";

I wish to move the groups into a seperate db to the roles. This means $grouptable and $grouproletable will be in seperate databases. My question is this: is it possible to use the simple and elegant solution that is the nested query across 2 tables that are in serperate dbs. I am totally lost here :(
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

you can reference a field by database.table.field
freefall
Forum Commoner
Posts: 48
Joined: Sun Jun 18, 2006 3:55 am

Post by freefall »

could you provide an example?
Post Reply