|
|
@ -231,10 +231,10 @@ abstract class SqlModel extends Model |
|
|
|
$where = $this->db->whereExpr($where); |
|
|
|
$group_by = $this->db->groupByExpr($group_by); |
|
|
|
$result = $this->query( |
|
|
|
'SELECT ' . $select_parent_query . ' FROM (' . |
|
|
|
'SELECT (' . |
|
|
|
(($sql_expression) ? $sql_expression : ('SELECT * FROM ' . $this->identify($this->table()))) |
|
|
|
. (($where) ? (' WHERE ' . $where) : '') |
|
|
|
. (($group_by) ? (' GROUP BY ' . $group_by) : '') . ') AS x', |
|
|
|
. (($group_by) ? (' GROUP BY ' . $group_by) : '') . ') AS count', |
|
|
|
$sql_expression_params, |
|
|
|
$cache_key |
|
|
|
); |
|
|
|
xxxxxxxxxx