Views query alter or condition not works Want add some or conditions in view queries. I tried two solutions but it not working. What I do wrong?

function up_coaching_custom_views_query_alter(&amp;$view, &amp;$query) {
  $search_string = empty($_GET['filter']) ? '' : '%' . db_like($_GET['filter']) . '%';
  if ($view-&gt;name != 'users' || empty($search_string)) {
    return;
  }

  // First way
  $condition = db_or()
      -&gt;condition('users.mail', $search_string, 'LIKE')
      -&gt;condition('field_data_field_company.field_company_value', $search_string, 'LIKE')
      -&gt;condition('field_data_field_user_name.field_user_name_value', $search_string, 'LIKE')
      -&gt;condition('field_data_field_title.field_title_value', $search_string, 'LIKE');
  $query-&gt;add_where(2, $condition);

  // Second way
  $query-&gt;where[2] = array(
    'args' =&gt; array(),
    'type' =&gt; 'OR',
    'conditions' =&gt; array(
      array(
        'field' =&gt; 'users.mail',
        'value' =&gt; $search_string,
        'operator' =&gt; 'LIKE',
      ),
      array(
        'field' =&gt; 'field_data_field_company.field_company_value',
        'value' =&gt; $search_string,
        'operator' =&gt; 'LIKE',
      ),
      array(
        'field' =&gt; 'field_data_field_user_name.field_user_name_value',
        'value' =&gt; $search_string,
        'operator' =&gt; 'LIKE',
      ),
      array(
        'field' =&gt; 'field_data_field_title.field_title_value',
        'value' =&gt; $search_string,
        'operator' =&gt; 'LIKE',
      ),
    ),
  );
  $query-&gt;set_where_group('AND', 2);
  dpm($query);
}
Ok, both solutions are work. The problem is in query fields that not exist because need add field tables. I didn't unserstand this because of this:

    catch (Exception $e) {
        $view-&gt;result = array();
        if (!empty($view-&gt;live_preview)) {
          drupal_set_message($e-&gt;getMessage(), 'error');
        }
        else {
          vpr('Exception in @human_name[@view_name]: @message', array('@human_name' =&gt; $view-&gt;human_name, '@view_name' =&gt; $view-&gt;name, '@message' =&gt; $e-&gt;getMessage()));
        }
      }


Views didn't show me error.