Reputation: 1976
I am trying to create this select query in Zend:
SELECT `receive`.`itemid`, `receive`.`room` FROM `tm_receive` AS `receive` LEFT JOIN `tm_rooms` ON tm_receive.room = tm_rooms.id
This is my Zend_DB_Table Select Object:
$select = $this->select()
->from(array('receive' => 'tm_receive'),
array('itemid', 'room'))
->joinLeft(array('room' => 'tm_rooms'),
'receive.room = room.id');
But I'm getting this error: Warning: Select query cannot join with another table in /var/www/myiartz/library/Zend/Db/Select.php on line 1350
WHAT AM I DOING WRONG?
Upvotes: 0
Views: 2384
Reputation: 10223
Try using this:
$database = Zend_Db::factory( ...options... );
$database->select()->from(array('receive' => 'tm_receive'),
array('itemid', 'room'))
->joinLeft(array('room' => 'tm_rooms'),
'receive.room = room.id');
The problem is when using select()
, the results will be limited to that table only.
Upvotes: 2