I have a problem with a query like this:
$sSqlAux = $this->select()->setIntegrityCheck(false)
->from(array("a_aux" => $this->_name), "id_a", $this->_schema)
->join(array("b_aux"=> "b"), "a_aux.id_a = b_aux.id_b", array(), $this->_schema)
->join(array("c_aux"=> "c"), "a_aux.id_inscrito = c_aux.id_c", array(), $this->_schema)
->where("b_aux.id_b = ?", $this->idB)
;
$sSql = $this->select()->setIntegrityCheck(false)
->from(array("a" => $this->_name), "a.id_a, a.campo_a", $this->_schema)
->joinLeft(array("b" => "b"), "a.id_a = b.id_b", "b.campo_b", $this->_schema)
->joinLeft(array("c" => "c"), "b.id_b = c.id_c", "c.campo", $this->_schema)
->where("c.campo_c = ?", "string")
->where("a.id_a IN (?)", new Zend_Db_Expr($sSqlAux))
->order("c.campo_c")
;
and to return the data, an asterisk is added before the name of the table, in this case, in one of my left joins, table b (LEFT JOIN schema.*b ON a.id_a = b.id_b) like the following example
SELECT
a.id_a,
a.campo_a
b.campo_b,
c.campo_c
FROM schema.a a
LEFT JOIN schema.*b ON a.id_a = b.id_b
LEFT JOIN schema.c c ON a.id_a = c.id_c
WHERE (c.campo_c = 'string')
AND (a.id_a IN (
SELECT a_aux.id_a
FROM schema.a a_aux
INNER JOIN schema.b b_aux ON a_aux.id_a = b_aux.id_b
INNER JOIN schema.c c_aux ON a_aux.id_a = c_aux.id_c
WHERE (a_aux.id_segundo_id = 5321)))
ORDER BY c.campo ASC
)
These are just examples of the problem I'm having, if error in logic or syntax error was in my typing. The real problem is that asterisk added by zend before the table name in the join.
If someone has understood the problem and have a solution that you can share would be of great help.
I'm using zend 1
thank's!