-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Ordering and Grouping #15523
Comments
As I mentioned in the comment of your SSCCE PR; Furthermore you are using a very different query in the 'What is actually happening?' section than would be generated in your example under 'Reproducible Example'. It would help if you used the same example and explained what the current generated SQL is and what you would expect the generated SQL to be like. |
If I understand correctly, they would like to have a way to generate the second query, which sorts first and groups by second instead of the current query which groups by then sorts. That would make this issue not a bug report but a feature request. The current behavior is what the query is correct as the default behavior. That being said, I think the query is niche enough that it can be handled by |
Sorry my bad , this is new sscce url sequelize/sequelize-sscce#249 Use score to order may be easy to understand |
Yes,That's what I mean.I thought about it,It's really not a bug , Just group after order and group before order. Query Builder is good resolve way , I used typeorm in past . Then we can not need to sequelize.query to write code because if statement to long to impact viewing code. |
// The following data in database,For example in this case ,I expect get the everyone's best score and rank the result
const data=[ { name:"tom" , score:1} , { name:"tom" , score:2 } , { name:"john" , score:1 } , { name:"john" , score:3 }] That might be the case ,subQuery sorting Result need to grouping after sorting. |
This bug report has not been verified by maintainers yet, and has been open for 14 days without activity. It will be closed if no further activity occurs within the next 14 days. If this is still an issue, consider commenting with more information to help us verify it. |
I'll close as this is not something we'll do until we have query-building capabilities |
Issue Creation Checklist
Bug Description
Reproducible Example
The result of the run is grouping before sorting
group by always get the first , because sorting execute after grouping
What do you expect to happen?
Sort before grouping Use query not very convenient
What is actually happening?
But create statement is simple statement So one select can't resolve order and group exist together .
Except use query ,For example
Not very convenient
Environment
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: