diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-07-28 23:58:02 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-07-28 23:58:02 -0700 |
commit | 941a350691c267e3b417eb461bdc9d499ee10598 (patch) | |
tree | c239c2f251ba788131215d1931894025f64ea0e2 /system/libraries/Database_Builder.php | |
parent | b3c1b4633c55b14bfed607336ca213cb2fda4447 (diff) |
Put the having clause after the group by clause to resolve this upstream issue:
http://dev.kohanaframework.org/issues/2923
Diffstat (limited to 'system/libraries/Database_Builder.php')
-rw-r--r-- | system/libraries/Database_Builder.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/system/libraries/Database_Builder.php b/system/libraries/Database_Builder.php index 62b2a163..e86ce379 100644 --- a/system/libraries/Database_Builder.php +++ b/system/libraries/Database_Builder.php @@ -1021,14 +1021,14 @@ class Database_Builder_Core { $sql .= "\n".'WHERE '.$this->compile_conditions($this->where); } - if ( ! empty($this->having)) + if ( ! empty($this->group_by)) { - $sql .= "\n".'HAVING '.$this->compile_conditions($this->having); + $sql .= "\n".'GROUP BY '.$this->compile_group_by(); } - if ( ! empty($this->group_by)) + if ( ! empty($this->having)) { - $sql .= "\n".'GROUP BY '.$this->compile_group_by(); + $sql .= "\n".'HAVING '.$this->compile_conditions($this->having); } if ( ! empty($this->order_by)) |