Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Queries between multiple databases

Status
Not open for further replies.

chenchomelo

Technical User
Mar 8, 2003
2
US
Is it possible to create queries using different databases?

I created the following query thinking it would be possible but it didn't work. DB 1 is called menagerie, DB 2 is called sampdb.

SELECT menagerie.pet.name, menagerie.pet.birth,
sampdb.president.last_name, sampdb.president.birth
FROM menagerie.pet, sampdb.president
WHERE MONTH(menagerie.pet) = MONTH(sampdb.president);
 
I dont think you can connect to two different databases and perform a single SQL statment on both of them.

Why are you using two seperate databases? Can you not use seperate tables within the same database? or can you build a temporay table in DB1 based on information from DB2?

This approach will make you life a lot easier.
 
I wrote the query out of curiousity, who knows... it could've worked!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top