Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORDER BY clause with no target should work #64

Open
blais opened this issue Feb 22, 2015 · 1 comment
Open

ORDER BY clause with no target should work #64

blais opened this issue Feb 22, 2015 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@blais
Copy link
Member

blais commented Feb 22, 2015

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 blais added P2 bug Something isn't working labels May 22, 2020
@blais blais transferred this issue from beancount/beancount Apr 3, 2022
@dnicolodi dnicolodi added enhancement New feature or request and removed query-sql bug Something isn't working labels Apr 5, 2022
@dnicolodi dnicolodi changed the title SQL query ORDER BY clause with no target should work ORDER BY clause with no target should work Apr 15, 2022
@dnicolodi
Copy link
Collaborator

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 dnicolodi added the question Further information is requested label Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants