Sfwd favicon 152

Join Two Tables From Different Databases On The Same Server

Posted by Weston Ganger on March 22, 2015

Sometimes you have an application with a master/shared database for shared models between applications and your regular application database. Maybe you need to join two tables to search the associations on them. Well heres an example SQL statement that will do such a thing.

**Note: This can only be done when the two databases are on the same server.

SELECT a.userID, b.usersFirstName, b.usersLastName FROM databaseA.TableA a INNER JOIN databaseB.TableB b ON a.userID=b.userID;

Related External Links:

Posted in Web Development and Tagged with sql mysql postgresql 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts