aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/risk_insight/views.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/risk_insight/views.py b/python/risk_insight/views.py
index 93c8906b..a3e0c7d8 100644
--- a/python/risk_insight/views.py
+++ b/python/risk_insight/views.py
@@ -48,9 +48,9 @@ def get_risk_numbers():
db = get_db()
attach = get_attach_from_name(index, series)
sqlstr = (sql.SQL("SELECT to_char(date, 'YYYY/MM/DD'), array_agg({}) FROM " \
- "(SELECT date, {} FROM risk_numbers_new " \
- "WHERE index=%s AND series=%s AND tenor=%s ORDER BY attach) "\
- "AS a GROUP BY date ORDER BY date").
+ "(SELECT date, {} FROM risk_numbers_new " \
+ "WHERE index=%s AND series=%s AND tenor=%s ORDER BY date, attach) "\
+ "AS a GROUP BY date ORDER BY date").
format(sql.Identifier(greek), sql.Identifier(greek)))
with db.cursor() as c:
c.execute(sqlstr, (index.upper(), series, tenor))