Skip to content
Advertisement

MySQL: Join query across multiple databases located on different servers

In SQL Server there is a way to join tables from multiple sql servers by using link tables.

I wonder whether is it possible to do the same? I am using PHP, does PHP provides this kind of facilities?

Advertisement

Answer

It isn’t necessarily easy, nor pretty, but this article gives some solutions to your problem: http://www.linux.com/archive/feature/52390

UPDATE

Since the link is gone now, here is more text

Creating a linked server using OLE DB for SQL Server This example creates a linked server named MyDatabase that uses the Microsoft OLE DB Provider for SQL Server.

USE master
GO
EXEC sp_addlinkedserver 
'MyDatabase',
N'SQL Server'
GO

Then you can reference as though they are on the same server, so if the databases are on the same mssql server then skip the above step and just do the following:

[Server name].[database name].[owner].table_name

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement