diff --git a/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs b/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs index f5fda6b09..22509c259 100644 --- a/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs +++ b/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs @@ -766,7 +766,8 @@ public SelectImpl GroupByRaw(string sql) if (string.IsNullOrWhiteSpace(sql)) return this; _useStates = false; _groupBy = $"{_groupBy}, {sql}"; - _select.GroupBy(_groupBy); + _useStates = false; + _select.GroupBy(_groupBy.Substring(2)); return this; } public SelectImpl GroupBy(string[] fields) @@ -783,7 +784,7 @@ public SelectImpl GroupBy(string[] fields) if (count > 0) { _useStates = false; - _select.GroupBy(_groupBy); + _select.GroupBy(_groupBy.Substring(2)); } return this; }