views:

44

answers:

2

Hi ,

i have tableA in sql database ,

and tableB in mysql database ,

How to write the join and which function should i use for that(myssql_query or mssql_query )

Thanks

+4  A: 

You can't do that unfortunately. Even if you connected to both via ODBC, you'd still have two separate connections. Besides MySQL knows nothing about MSSQL, and MSSQL knows nothing about MySQL.

An additional layer of abstraction would be required, but it would possibly be very inefficient.

Mchl
A: 

So far as I know it is not possible with default PHP (mysql and mssql) functions, but I'm pretty sure that it is possible with ODBC on your machine.

With ODBC you can make cross DB connections between MySQL and MSSQL. So I think you can create a query like this:

SELECT 
    MYSQL.db.tbl_x.*
LEFT JOIN 
    MSSQL.db.tbl_y 
ON
    MYSQL.db.tbl_x.id=MSSQL.db.tbl_y=id

If you only would like to copy some data, I recommend Navicat.

Bas van Dorst