List:General Discussion« Previous MessageNext Message »
From:Eric Braswell Date:May 5 2006 9:32pm
Subject:Re: possible to select from multiple databases?
View as plain text  
Bing Du wrote:
 > I have two separate databases that I need to query data from.  In the
 > following SELECT statement, 'title' and 'db_entry_name' are in database1,
 > and 'projectID' is in database2.  If they were in one database, this
 > SELECT should work.  How should I tweak it to get data from both 
 > and database2?  Is that even possible in single SELECT?
 > SELECT title, db_entry_num, projectID FROM account_info, ResearchProjects
 > WHERE ResearchProjects.IDNo = $idno AND account_info.db_entry_num =
 > ResearchProjects.projectID

This is easy as long as the dbs are on the same machine:

SELECT * from db1.table1, db2.table1...


Eric Braswell
Web Manager     MySQL AB
Cupertino, USA

possible to select from multiple databases?Bing Du5 May
  • RE: possible to select from multiple databases?Jimmy Guerrero5 May
  • Re: possible to select from multiple databases?Eric Braswell5 May