How to fix migrate query() that's breaking my migration?
Adding a query to prepareRow() is the way to go:

  public function prepareRow($row) {
    if (parent::prepareRow($row) === FALSE) {
      return FALSE;
    }
    $query = Database::getConnection('default', 'd6source')
           -&gt;select('image_attach', 'ia')
           -&gt;fields('ia')
           -&gt;condition('nid',$row-&gt;nid);
    $query-&gt;addExpression('GROUP_CONCAT(DISTINCT ia.iid)', 'iid');
    $query-&gt;groupBy('ia.nid');
    $result = $query-&gt;execute();
    foreach ($result as $r) {
      $iid[] = $r-&gt;iid;
    }
    $row-&gt;iid = implode (",", $iid); 
  }


This has the huge added benefit of not messing up the source row count.