pager query with join I plan to list all polls in the most recent order where I need to join my "poll" table with the "node" table and display them with pager. Here is what I do:

$polls_query = db_select('poll', 'p')
              -&gt;extend('PagerDefault')
              -&gt;limit(3);
$polls_query-&gt;join('node', 'n', 'n.nid = p.nid')
            -&gt;fields('p', array('nid'))
            -&gt;condition('p.active', 1, '=')
            -&gt;orderBy('n.created', 'DESC');
$result = $polls_query-&gt;execute();
foreach ($result AS $poll) {
  $polls[] = array('data' =&gt; drupal_render(node_view(node_load($poll-&gt;nid), 'teaser')));
}
$content['pager_list'] = array(
  '#theme' =&gt; 'item_list',
  '#items' =&gt; $polls,
  '#title' =&gt; t('Listing Consensus'),
  '#type' =&gt; 'ul',
);
$content['pager_pager'] = array('#theme' =&gt; 'pager');
return drupal_render($content);


Unfortunately I see a white screen of death and the php error log says "PHP Fatal error:  Call to a member function fields() on a non-object in  .. " and thats the line where I mention after fields. If I dont use join, everything works fine. 

If anyone else has had similar problems, please share the solution.
The join() method doesn't return the query object to isn't chainable.

If you change your code to this you should be fine:

$polls_query = db_select('poll', 'p')
  -&gt;extend('PagerDefault')
  -&gt;limit(3);

$polls_query-&gt;join('node', 'n', 'n.nid = p.nid');

$polls_query-&gt;fields('p', array('nid'))
  -&gt;condition('p.active', 1, '=')
  -&gt;orderBy('n.created', 'DESC');

// etc...