View Single Post
Old 10-21-2007, 06:39 PM  
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Quote:
Originally Posted by Varius View Post
Will it be on the same server? If so, you can have different databases and access them without opening new connections. Cross-database joins also work fine in mysql.

Example:

you create three databases: common, site1, site2

You can do queries such as:

SELECT a.field1, a.field2, b.field2 FROM site1.table1 a JOIN common.table1 b ON a.field1=b.field1;

Basically, in your queries that use more than one database just have the dbname in the query before the table name.

Hope that answers your question.
I've never tried cross database joins.. I'll have to give that a go as that would work very nicely. How do you handle the DB connections in this case? Which linkid would you use?
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote