title: How to add "order by" on a Magento Query
body: <p>I installed a script for magento. It allows to add comments on orders. So it shows ONE comment on order grid.</p>
  
  <p>The problem is that it doesn't sort comment by "created_at" column. I don't know how to set the order.</p>
  
  <p>This is the portion of code:</p>
  
  <pre><code> protected function _initSelect()
  {
      parent::_initSelect();
  
      // Join order comment
      $this-&gt;getSelect()-&gt;joinLeft(
          array('ordercomment_table' =&gt; $this-&gt;getTable('sales/order_status_history')),
          'main_table.entity_id = ordercomment_table.parent_id AND ordercomment_table.comment IS NOT NULL',
          array(
              'ordercomment' =&gt; 'ordercomment_table.comment',
          )
      )-&gt;group('main_table.entity_id');
  
      return $this;
  }
  </code></pre>
  
  <p>Thanks for your help.</p>