PHP error 500 when including a left join on a pager query in db_select()
The documentation says:


  Joins cannot be chained, so they have to be called separately (see Chaining). If you are chaining multiple functions together do it like this:

$query = db_select('node', 'n');
$query-&gt;join('field_data_body', 'b', 'n.nid = b.entity_id');
$query
  -&gt;fields('n', array('nid', 'title'))
  -&gt;condition('n.type', 'page')
  -&gt;condition('n.status', '1')
  -&gt;orderBy('n.created', 'DESC')
  -&gt;addTag('node_access');