How can I substitute field in hook_query_alter?
SelectQuery::getFields() returns by reference, so something like this should do it:

$fields =&amp; $query-&gt;getFields();
$found_index = FALSE;
foreach ($fields as $key =&gt; $val) {
  // Check what's in the field, note the index if it matches the one to remove
}

if ($found_index !== FALSE) {
  unset($fields[$found_index];
}