Исправление ошибки в SqlCriteria.count() - дублирующееся COUNT(COUNT( * во внутреннем sql-запросе
This commit is contained in:
@ -226,12 +226,12 @@ abstract class SqlModel extends Model
|
||||
return new SqlResultProvider($result);
|
||||
}
|
||||
|
||||
public function count($select = 'x.count', $where, $heaving = null, $group_by = null, $sql_expression = null, $sql_expression_params = array(), $cache_key = null)
|
||||
public function count($select_parent_query = 'x.count', $where, $heaving = null, $group_by = null, $sql_expression = null, $sql_expression_params = array(), $cache_key = null)
|
||||
{
|
||||
$where = $this->db->whereExpr($where);
|
||||
$group_by = $this->db->groupByExpr($group_by);
|
||||
$result = $this->query(
|
||||
'SELECT ' . $select . ' FROM (' .
|
||||
'SELECT ' . $select_parent_query . ' FROM (' .
|
||||
(($sql_expression) ? $sql_expression : ('SELECT * FROM ' . $this->identify($this->table())))
|
||||
. (($where) ? (' WHERE ' . $where) : '')
|
||||
. (($group_by) ? (' GROUP BY ' . $group_by) : '') . ') AS x',
|
||||
|
Reference in New Issue
Block a user