Implements SelectInterface::countQuery().
Overrides SelectInterface::countQuery
public function countQuery() {
$count = $this
->prepareCountQuery();
$query = $this->connection
->select($count, NULL, $this->queryOptions);
$query
->addExpression('COUNT(*)');
return $query;
}