|
|
@ -89,7 +89,7 @@ class SqlCriteria |
|
|
|
$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); |
|
|
|
$this->sql_expression = preg_replace('#SELECT.+FROM#i', '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; |
|
|
|