From 38ec11855134116dff6d9642b73207ca3134fcb2 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Wed, 23 Dec 2015 18:10:19 +0300 Subject: [PATCH 1/1] fix select ordering --- web/query.cgi | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/web/query.cgi b/web/query.cgi index 690eb9a..f45c844 100755 --- a/web/query.cgi +++ b/web/query.cgi @@ -48,16 +48,14 @@ cgiMain = do "select to_seconds(timestamp) as time, value+adj as value from \ \(select c.timestamp timestamp, c.value value, \ \(select sum(value) from coldadj a where a.timestamp <= c.timestamp \ - \) adj from coldcnt c \ - \where timestamp between ? and ? order by timestamp \ - \) t;" (slo, shi) + \) adj from coldcnt c where timestamp between ? and ? \ + \) t order by timestamp;" (slo, shi) hot <- liftIO $ query conn "select to_seconds(timestamp) as time, value+adj as value from \ \(select c.timestamp timestamp, c.value value, \ \(select sum(value) from hotadj a where a.timestamp <= c.timestamp \ - \) adj from hotcnt c \ - \where timestamp between ? and ? order by timestamp \ - \) t;" (slo, shi) + \) adj from hotcnt c where timestamp between ? and ? \ + \) t order by timestamp;" (slo, shi) [(ccold, chot)] <- liftIO $ query_ conn "select lcold+acold as cold, lhot+ahot as hot from \ \(select value as lcold from coldcnt order by timestamp desc limit 1) cc, \ -- 2.39.2