|
|
@ -88,6 +88,8 @@ class SqlCriteria |
|
|
|
if (!$this->sql_expression) { |
|
|
|
$this->sql_expression = 'SELECT COUNT(' . ($select ? $select : '*') . ') as count FROM :table'; |
|
|
|
$select_parent_query = 'x.count'; |
|
|
|
} else { |
|
|
|
$this->sql_expression = preg_replace('#SELECT.+FROM#', 'SELECT COUNT(' . ($select ? $select : '*') . ') as count FROM', $this->sql_expression); |
|
|
|
} |
|
|
|
$count = $this->model->count($select_parent_query, $this->where, null, $this->group_by, $this->sql_expression, $this->sql_expression_params)->fetchField('count'); |
|
|
|
$this->sql_expression = $sql_expression_backup; |
|
|
|