Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By tm0032938 on
I want to merge SQL query of two views using Union keeping contextual filter intact.Please let me know as how to achieve this in Views UI or using hook like hook_views_query_alter/hook_views_pre_execute.
Comments
_
Can't be done through the UI. You need to use hook_views_query_alter in a custom module. See http://api.drupal.org/api/views/views.api.php/function/hook_views_query_... for more info.
Example Required
Can I get an example or link in Internet where the union statement is used in hook_views_query_alter?
The link provided by you contains example related to Grouping and sorting inside view.
_
i don't know of a union specific example, but views just uses the d7 db api: http://api.drupal.org/api/drupal/includes!database!select.inc/function/S...