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

clear orderBy #2360

Closed
jeremymarc opened this issue Nov 30, 2017 · 4 comments
Closed

clear orderBy #2360

jeremymarc opened this issue Nov 30, 2017 · 4 comments

Comments

@jeremymarc
Copy link

@jeremymarc jeremymarc commented Nov 30, 2017

To paginate, I'm using query.clone().count('* as count'), but because the query has an ORDER BY, I'm getting an error: "must appear in the GROUP BY clause or be used in an aggregate function".

Is there a way to clear the query orderBy?

Thanks

@elhigu
Copy link
Member

@elhigu elhigu commented Nov 30, 2017

No there is not :( PR for that is always welcome. As a workaround you may be able to clone() query builder before orderBy is added?

Loading

@elhigu elhigu closed this Nov 30, 2017
@roemhildtg
Copy link

@roemhildtg roemhildtg commented Jan 11, 2018

I'm running into this too and would be willing to take a stab at fixing it if I could get a little bit of help on where to start.

I'm using feathers-bookshelf-service with bookshelf.

Loading

@elhigu
Copy link
Member

@elhigu elhigu commented Jan 11, 2018

@roemhildtg here is the PR where clearSelect and clearWhere was added #1912 it should serve as a good reference how to implement more clearXXX methods

Loading

@melnikaite
Copy link

@melnikaite melnikaite commented Feb 6, 2018

For orderBy you can use queryInstance._clearGrouping('order') to delete all order statements

Loading

revolunet added a commit to revolunet/knex that referenced this issue Apr 1, 2018
elhigu added a commit that referenced this issue Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants