I want to join two tables in differenet databases on the same server. Could someone tell me how I could do this in Zend Frameworks Db adapter?
相关问题
- SQL join to get the cartesian product of 2 columns
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
If the databases are on the same server and your user have access to them both, you can use full path - SELECT database_name.table_name.col_name...
Otherwise there is no chance for you to join them because of the principle. The join is done by SQL server - which would need to login to the other database...
On Oracle there is a feature called DBLink... which offers abbility to link other table/view from different server. Not sure about MySQL.
To make queries using different adapters you can use:
But again, you are still limited in things like union of these two... You can't do that because of the very nature of how the database works
see:
connecting to two different databases with Zend Framework
http://blog.keppens.biz/2009/04/zendapplication-multiple-databases.html
http://blog.ekini.net/2009/03/04/zend-framework-connecting-to-2-databases/
Build tableGateway from your dbAdapter before joining two tables from different database.