How to orderBy joined table after ordered main in db_select
Not sure I understand but you're not limited to a single orderby() in a SelectQuery so you would just add another one with the correct alias, e.g.

$query -&gt; fields('w', array('entity_id', 'field_cg_w_value'))
  -&gt;condition('w.field_cg_w_value', $options['string'] . '%', 'LIKE')
  -&gt;orderBy('w.field_cg_w_value', 'ASC')
  -&gt;orderBy('g.entity_id', 'DESC');