We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
like this? db.Group("age,score")
db.Group("age,score")
The text was updated successfully, but these errors were encountered:
Group belongs to Chaining Method.
db.Group("age").Group("score")
Sorry, something went wrong.
Hello @wlbwlbwlb
GORM's Group method allows grouping by multiple fields by passing a comma-separated string of field names. Here's an example:
var results []YourModel db.Model(&YourModel{}). Select("field1, field2, COUNT(*) as count"). Group("field1, field2"). Find(&results)
In this query, field1 and field2 are the fields you want to group by, and count will hold the count of records for each group.
Cheers!!
Resolved. Thank you all
jinzhu
No branches or pull requests
Your Question
The document you expected this should be explained
like this?
db.Group("age,score")
Expected answer
The text was updated successfully, but these errors were encountered: