Changed order by clause in select entries query.

This commit is contained in:
Alexis Lahouze 2013-01-10 13:16:23 +01:00
parent 41618f3096
commit 86cee7faa9

View File

@ -17,7 +17,7 @@ class EntryAPI extends RestAPI {
$account=$this->_request['account']; $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("day", $day);
$statement->bindParam("account", $account); $statement->bindParam("account", $account);