Hi, I am refactoring some code from preview 0.2 to 1.0. And I got some
trouble in places where I used sub-queries as joins. Here is a small
example:
<?php
require_once 'Zend/Db.php';
require_once 'Zend/Db/Select.php';
$params = array ('host' => '****',
'username' => '****',
'password' => '****',
'dbname' => '****');
$db = Zend_Db::factory('pdo_mysql', $params);
$s1 = new Zend_Db_Select($db);
$s1->from(array('t1'=>'test'));
$s2 = new Zend_Db_Select($db);
$s2->from(array('t2'=>'test2'));
$s2->join(array('tj'=>new Zend_Db_Expr('('.((string) $s1).')')),
'on tj.id = t2.id',
array());
?>
This gives the following output:
SELECT
`t2`.*
FROM `test2` AS `t2`
INNER JOIN `(SELECT
``t1```.`*
FROM ``test`` AS ``t1``)` AS `tj` ON on tj.id = t2.id
I have also tried without Zend_Db_Expr but no luck.
How can I get rid of the quoting of the sub-query?
Best Regards,
Bjarte