- š·šŗRussia pvasili
ā¦ $query1->union($query2, 'UNION ALL'); $query1 = $query1->extend('PagerDefault'); $results = $query1->execute(); ā¦
we can try to do
ā¦ $query1->union($query2, 'UNION ALL'); $query_pagination = db_select($query1,'q')->fields('q'); $query_pagination = $query_pagination->extend('PagerDefault'); $results = $query_pagination->execute(); ā¦
- First commit to issue fork.
- š®š³India himanshu_jhaloya Indore
Try this
$query1 = db_select('a_blog', 'cb')
->fields('cb', array('title', 'changed_date'));$query2 = db_select('a_gallery', 'cg')
->fields('cg', array('title', 'changed_date'));// Ensure both queries have the same number of columns and name them consistently.
$query1->addField('cb', 'title', 'title');
$query1->addField('cb', 'changed_date', 'changed_date');$query2->addField('cg', 'title', 'title');
$query2->addField('cg', 'changed_date', 'changed_date');// Combine the queries using UNION ALL.
$query = $query1->union($query2, 'UNION ALL');// Extend the combined query with PagerDefault.
$query = $query->extend('PagerDefault');// Execute the modified query.
$results = $query->execute();