Browse Source

Considered that MySQL>5.7 ignores ORDER in GROUP BY

Dmitry Yu Okunev 4 years ago
parent
commit
3b69bd7b18
1 changed files with 2 additions and 2 deletions
  1. 2 2
      unit.go

+ 2 - 2
unit.go

@@ -76,14 +76,14 @@ func (sql Unit) ConsiderPersNumbers() *UnitScope {
 	return sql.Scope().ConsiderPersNumbers()
 }
 func (sql *UnitScope) ConsiderPersNumbers() *UnitScope {
-	return sql.Group("PersNumber").Order("CreateOrderDate", "DESC")
+	return sql.Group("PersNumber DESC").Order("CreateOrderDate", "DESC")
 }
 
 func (sql Unit) ConsiderUniqueCodes() *UnitScope {
 	return sql.Scope().ConsiderUniqueCodes()
 }
 func (sql *UnitScope) ConsiderUniqueCodes() *UnitScope {
-	return sql.Group("Code").Order("id", "DESC")
+	return sql.Group("Code DESC").Order("id", "DESC")
 }
 
 func (sql Unit) RealOnly() *UnitScope {