I am having trouble translating this request to use ZF Zend_Db_Select :
SELECT b.id, b.title, b.description FROM memberships AS m JOIN blogs AS b ON b.id = m.blog_id WHERE m.user_id = ? ORDER BY m.created LIMIT 0, 30
(this query works and returns the results)
Memberships - a table of links between blogs and users . This is a simple matter | id | blog_id | user_id | | id | blog_id | user_id | .
Here is what I still have:
// $table = Zend_Db_Table instance, $id = a user id $select = $table->select() ->from(array('m' => 'memberships'), array('b.id', 'b.title', 'b.description')) ->join(array('b' => 'blogs'), 'b.id = m.blog_id') ->where('m.user_id = ?', (int) $id) ->order('m.created DESC') ->limit(0, 30);
This is (weird (to me)) the error I get:
#0: Select query cannot join with another table
It happened on line 211 D:\...\library\Zend\Db\Table\Select.php .
Thank you for your help.
zend-framework zend-db-table zend-db-select
Ross
source share