title: Yii order by another table CActiveDataProvider
body: <p>I am a bit stumped on this. Basically I have two tables:</p>
  
  <p><strong>Page:</strong></p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  </ul>
  
  <p><strong>Points:</strong></p>
  
  <ul>
  <li>id-  </li>
  <li>pageid</li>
  <li>points</li>
  </ul>
  
  <p>I am looking to get the records from the <em>Page</em> table, and sort it by the amount of points it has in the <em>Points</em> table (the points field)</p>
  
  <p>Currently I have:</p>
  
  <pre><code>$dataProvider=new CActiveDataProvider('Page',array(
          'criteria'=&gt;array(
              'condition'=&gt;"active = 1 AND userid IN (".$ids.")",
              'order'=&gt;"???",
          ),
  
          'pagination'=&gt;array(
              'pageSize'=&gt;30,
          ),
      ));
  </code></pre>
  
  <p>I just don't know how to sort it by the <em>Points</em> table value for the relevant record
  I have set up a relation for the <em>Page/Points</em> tables like so:</p>
  
  <p>(in the Page model)</p>
  
  <pre><code>'pagepoints' =&gt; array(self::HAS_ONE, 'Points', 'pageid'),
  </code></pre>
  
  <p>Thanks</p>