How to use select query as where clause in Drupal views module query alter. You can't use hook_views_query_alter, because it places single quotes around the value. So you can't use query instead of value. Instead use hook_views_post_build.
Source code viewer
/** * Implements hook_views_query_alter(). * * Affects pager and other extras */ function HOOK_views_query_alter(&$view, &$query) { if ($view->name == 'MY_VIEW') { } } // -------------------- OR -------------------- /** * Implements hook_views_post_build(). * * Example use of select query in where clause */ function HOOK_views_post_build(&$view) { if ($view->name == 'MY_VIEW') { $view->build_info['query']->where(" node.nid IN ( SELECT nid FROM my_nid_table WHERE my_nodes = 0 ) "); } }Programming Language: PHP