beanquery icon indicating copy to clipboard operation
beanquery copied to clipboard

ORDER BY clause with no target should work

Open blais opened this issue 10 years ago • 1 comments
trafficstars

This should work:

  beancount> select account, sum(position) where currency = 'IRAUSD' group by account order by type;
  ERROR: All non-aggregates must be covered by GROUP-BY clause in aggregate query.

blais avatar Feb 22 '15 19:02 blais

I am not sure what the query would do if accepted.

BQL does not accept bare columns in aggregate queries. Not accepting bare columns in ORDER BY clause as well seems consistent with this choice. SQLite accepts bare columns in aggregate queries https://sqlite.org/lang_select.html#bare_columns_in_an_aggregate_query A rapid test shows that bare columns are accepted both in the targets list and in the ORDER BY clause. However, the returned value is undefined and the ORDER BY has no effect.

dnicolodi avatar Apr 15 '22 15:04 dnicolodi