Set what field the query will count() on for paging.
function set_count_field($table, $field, $alias = NULL) {
if (empty($alias)) {
$alias = $table . '_' . $field;
}
$this->count_field = array(
'table' => $table,
'field' => $field,
'alias' => $alias,
'count' => TRUE,
);
}