Join Two Tables From Different Databases On The Same Server

Posted by Weston Ganger

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:

Article Topic:Software Development - Web Development

Date:March 22, 2015

Recommended Posts



Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected