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

Comments

Projects
None yet
4 participants
@jeremymarc
Copy link

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

This comment has been minimized.

Copy link
Collaborator

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?

@elhigu elhigu closed this Nov 30, 2017

@roemhildtg

This comment has been minimized.

Copy link

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.

@elhigu

This comment has been minimized.

Copy link
Collaborator

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

@melnikaite

This comment has been minimized.

Copy link

melnikaite commented Feb 6, 2018

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

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
You can’t perform that action at this time.