@ -81,9 +81,11 @@ class SqlCriteria
public function count($select = 'x')
{
$this->defineJoinExpressions();
$sql_expression_backup = $this->sql_expression;
if ($select) {
$this->select( $select );
}
if (!$this->sql_expression) {
$this->sql_expression = 'SELECT COUNT(*) as count FROM :table';