Why am I getting this:
An error occurred
Application error
Exception information:
Message: Select query cannot join with another table
while trying to join two tables?
I have this line code inside my model which extends Zend_Db_Table_Abstract
public function getProjects() {
$select = $this->select()
->from(array('sub' => $this))
->join(array('main' => 'main_projects'), 'main.mai_id = sub.mai_id');
return $this->fetchAll($select);
}
And I use this in my controller: $this->view->entries = $this->sub_projects->getProjects();
Why the hell I get this error? I just want to make a simple join
SELECT sub.*, main.mai_title FROM sub_projects AS sub INNER JOIN main_projects AS main ON sub.mai_id = projects.mai_id;
enter code here