You would need to use the TableIdentifier as your $table where $table is accepted:

https://github.com/zendframework/zf2/blob/master/library/Zend/Db/Sql/TableIdentifier.php

This is supported in Zend\Db\Sql\Select, Insert, Update, Delete.

-ralph

On 1/10/13 3:52 AM, natix wrote:
Hi,

I have 3 databases on the same server with the same login credentials for
each database.

I am trying to write a query in zf2 that selects from database A but joins
in a table from database B. This query works perfectly if I execute it from
the command line but I can't get it into zf2.

The query is basically:
SELECT * FROM dbA.table1 AS a LEFT JOIN dbB.table2 AS b;

The problem is how the zf2 Select class quotes. When I try to add the
database name I get the following:
SELECT `table1`.*, FROM `table1` AS `a` LEFT JOIN `dbB.table2` AS `b`

The problem is the backticks around dbB.table2. I need them to be
"`dbB`.`table2`.

How can I write this query in zf2?



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Join-on-different-database-tp4658711.html
Sent from the Zend Framework mailing list archive at Nabble.com.



--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to