diff --git a/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs b/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs index 1f4819753..a0417bafb 100644 --- a/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs @@ -104,6 +104,10 @@ namespace SqlSugar this.OldSql += this.Offset; } result = GetSqlQuerySql(result); + if (isFirst && IsDistinct) + { + result = result.Replace("TOP 1 DISTINCT", "TOP 1 "); + } return result; }