Your Question

The document you expected this should be explained

like this? db.Group("age,score")

Expected answer

Comment From: alex-guoba

Group belongs to Chaining Method.

db.Group("age").Group("score")

Comment From: sandeepchowdary7

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!!

Comment From: wlbwlbwlb

Resolved. Thank you all