From 86cee7faa9114f6185234d38c24d91de3b704ca6 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Thu, 10 Jan 2013 13:16:23 +0100 Subject: [PATCH] Changed order by clause in select entries query. --- src/html/api/entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/html/api/entry.php b/src/html/api/entry.php index ff13390..2088b9f 100644 --- a/src/html/api/entry.php +++ b/src/html/api/entry.php @@ -17,7 +17,7 @@ class EntryAPI extends RestAPI { $account=$this->_request['account']; - $statement=$connection->prepare("select id, value_date, operation_date, label, value, account_id, sold, pointedSold from (select *, sum(value) over(order by value_date, operation_date, label desc, id desc) as sold, sum(value) over(partition by operation_date is not null order by value_date, operation_date, label desc, id desc) as pointedSold from entry where account_id=:account order by value_date desc, operation_date desc, label, id) as e where date_trunc('month', e.value_date) = :day "); + $statement=$connection->prepare("select id, value_date, operation_date, label, value, account_id, sold, pointedSold from (select *, sum(value) over(order by value_date, operation_date, label desc, value desc) as sold, sum(value) over(partition by operation_date is not null order by value_date, operation_date, label desc, value desc) as pointedSold from entry where account_id=:account order by value_date desc, operation_date desc, label, value) as e where date_trunc('month', e.value_date) = :day "); $statement->bindParam("day", $day); $statement->bindParam("account", $account);