How to add where clause to custom Drupal view
You can implement hook_view_query_alter() to add where condition.

function MODULE_NAME_views_query_alter(&amp;$view, &amp;$query) {
  if ($view-&gt;name == 'view_name') {
    $query-&gt;add_where(1,'node.nid',$value,'=');  
  }
}