title: Yii: working with multiple tables
body: <p>Trying to execute this query:</p>
  
  <pre><code>SELECT md.title, md.url 
     FROM MenuData md, Menu m 
     WHERE m.parent=0 
        AND m.menuType=1 
        AND md.menuID = m.id 
    ORDER BY m.sort ASC
  </code></pre>
  
  <p>Like below: </p>
  
  <pre><code>  $criteria = new CDbCriteria();
              $criteria-&gt;together = true;
              $criteria-&gt;with = array('MenuData');
              $criteria-&gt;compare("Menu.menuType", 1);
              $criteria-&gt;compare("Menu.parent", 0);
              $criteria-&gt;join = 'LEFT JOIN MenuData ON MenuData.menuID=Menu.id';
              $criteria-&gt;order = '`Menu.sort` ASC';
              $criteria-&gt;compare("MenuData.locale", $this-&gt;lang);
              $results = Menu::model()-&gt;findAll($criteria);
  </code></pre>
  
  <p>Have both Menu and Menudata models. But getting following error: </p>
  
  <pre><code>Relation "MenuData" is not defined in active record class "Menu". 
  </code></pre>