summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ansisql.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/ansisql.py')
-rw-r--r--lib/sqlalchemy/ansisql.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py
index a344e017c..602da58ee 100644
--- a/lib/sqlalchemy/ansisql.py
+++ b/lib/sqlalchemy/ansisql.py
@@ -371,14 +371,14 @@ class ANSICompiler(sql.Compiled):
if group_by:
text += " GROUP BY " + group_by
- order_by = self.get_str(select.order_by_clause)
- if order_by:
- text += " ORDER BY " + order_by
-
if select.having is not None:
t = self.get_str(select.having)
if t:
text += " \nHAVING " + t
+
+ order_by = self.get_str(select.order_by_clause)
+ if order_by:
+ text += " ORDER BY " + order_by
text += self.visit_select_postclauses(select)