Closed zengshun2019 closed 2 months ago
count, err := qu.WithContext(ctx). Select( qu.UID, qu.Name, qu.Avatar, qu.PhoneNumber, qu.Email, qu.Gender, qu.BirthDay, qu.Address, qu.Desc, qu.IsDefault, qu.Status, qr.Name.GroupConcat().As("Role"), qd.Name.As("Dept"), qu.LastLoginTime, qu.CreatedAt, ). Where(where...). LeftJoin(qur, qur.UID.EqCol(qu.UID)). LeftJoin(qr, qr.Label.EqCol(qur.RoleLabel)). LeftJoin(qd, qd.Label.EqCol(qu.DepartmentLabel)). Group(qu.UID). Order(order). ScanByPage(&result, (s.CurrentPage-1)*s.PageSize, s.PageSize)
ERROR: column "user.id" must appear in the GROUP BY clause or be used in an aggregate function (SQLSTATE 42803)
Your Question
count, err := qu.WithContext(ctx). Select( qu.UID, qu.Name, qu.Avatar, qu.PhoneNumber, qu.Email, qu.Gender, qu.BirthDay, qu.Address, qu.Desc, qu.IsDefault, qu.Status, qr.Name.GroupConcat().As("Role"), qd.Name.As("Dept"), qu.LastLoginTime, qu.CreatedAt, ). Where(where...). LeftJoin(qur, qur.UID.EqCol(qu.UID)). LeftJoin(qr, qr.Label.EqCol(qur.RoleLabel)). LeftJoin(qd, qd.Label.EqCol(qu.DepartmentLabel)). Group(qu.UID). Order(order). ScanByPage(&result, (s.CurrentPage-1)*s.PageSize, s.PageSize)
ERROR: column "user.id" must appear in the GROUP BY clause or be used in an aggregate function (SQLSTATE 42803)
The document you expected this should be explained
Expected answer