Query does not change I've got a problem with hook_views_query_alter(). 
I want to override the view's query with a rather complex one. In the first step, I placed the hook in my views.inc and tested it. The hook is called. But none of my tests to alter the query worked. 

function glass_lagermanagement_views_query_alter(&amp;$view, &amp;$query) {
  if ($view-&gt;name == 'lagerbestand') {
    $query = db_select('materials');
    $query-&gt;condition('materials.ID', 1, '==');
  }
}


To test the function, I want to show only one entry which has got the ID "1", but nothing happens at all in the view. What am I doing wrong?

I'm using Drupal 7 here. It is an old project I need to update.
I got it.
I used this code to alter the query and it worked.

$query-&gt;where[1]['conditions'][0] = array('field'=&gt;"materials.ID","value"=&gt;'1',"operator"=&gt;"LIKE");