Page 1 of 1

Php/Mysql nested query using 2 dbs

Posted: Fri Sep 15, 2006 8:15 am
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 :(

Posted: Fri Sep 15, 2006 8:53 am
by volka
you can reference a field by database.table.field

Posted: Fri Sep 15, 2006 12:19 pm
by freefall
could you provide an example?