views:

56

answers:

1

Is it possible to do cross database joins in drupal?

Say you have two databases, drupal and old_data_source. You want to join drupal.node to old_data_source.page.

db_set_active() can be called to use multiple databases. However can't find anything about cross database table joins!

(I'm looking into this as part of a migration script and will be removing old_data_source)

+1  A: 

Drupal doesn't support having more than one active database at a time. Main reason is probably that this is a mysql specific feature.

You can do this with php and skip the Drupal database layer. Since it's only for a migration script that should be run once, it'll be fine to make the code database specific. Just us mysql_ connect etc. Probably be a good idea to end using db_set_active

googletorp