开发者

sql and mysql combined query

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜