1

i have to do a select from multi tables using zend_db_select for this sql :

SELECT t1.id,t2.ids, t3.uid 
FROM table1 t1,table2 t2, table3 t3

this is the code used :

$subQuery = $this->getDbTable ()->select ()->setIntegrityCheck ( false )
->from(array('t1'=>'table1','t2'=>'table2','t3'=>'table3'),array('t1.id','t2.ids','t3.uid'))
->query()
->fetchAll();

so i have message error say that t2.ids is not in the column list because zend_db_select take just the first table

any solution to resolve this problème ? thaks

NoOneElse
  • 1,101
  • 2
  • 11
  • 15

1 Answers1

0

You can use a cross join with:

$subQuery = $this->getDbTable ()->select ()->setIntegrityCheck ( false )
->from(array('t1'=>'table1'),array('t1.id'))
->joinCross(array('t2'=>'table2'),array('t2.ids'))
->joinCross(array('t3'=>'table3'),array('t3.uid'))
->query()
->fetchAll();